opIn_r not detected

spir denis.spir at gmail.com
Thu Feb 10 14:32:13 PST 2011


On 02/10/2011 07:43 PM, Stewart Gordon wrote:
> On 10/02/2011 12:59, spir wrote:
>> Hello,
>>
>> Implicite deref of struct pointers on member access works fine for data,
>> methods, even
>> special methods with language semantics like opEquals (see example below).
>> But I cannot have 'in' work with method opIn_r. I get:
>> Error: rvalue of in expression must be an associative array, not S*
>> What do I have wrong? Or is it a bug: the compiler does not even search the
>> struct for
>> opIn_r? But then, why does it do it for opEquals?
> <snip>
>
> That got me thinking. It would appear that it auto-dereferences only the left
> operand. Try adding this to your code and see:
>
> writeln(s2 == sp);

Works, indeed, but using opEquals on s2, and because s2 is not "pointed".

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d-learn mailing list