Problem with taking inout, const references

Uranuz neuranuz at gmail.com
Wed Mar 26 01:16:00 PDT 2014


Source of error is that I have also the following methods inside 
ResponseCookise class:

	void opIndexAssign(string value, string name)
	{	auto cookie = name in this;
		if( cookie is null )
			_cookies ~= Cookie(name, value);
		else
			cookie.value = value;
	}

	void opIndexAssign( ref Cookie value, string name )
	{	auto cookie = name in this;
		if( cookie is null )
			_cookies ~= value;
		else
			*cookie = value;
	}

In 2.065 I get other error message than in 2.064, but it still 
not very informative. Why I get message inside *in* operator but 
not in *opIndexAssign*?. And how could I solve this?

/d800/f144.d(49): Error: cannot implicitly convert expression 
(&c) of type inout(const(Cookie))* to inout(Cookie)*
/d800/f144.d(38): Error: template instance 
f144.ResponseCookies.opBinaryRight!"in" error instantiating
/d800/f144.d(38): Error: rvalue of in expression must be an 
associative array, not f144.ResponseCookies


More information about the Digitalmars-d-learn mailing list