Searching the digitalmars webpage
Extrawurst
spam at extrawurst.org
Wed Jan 30 04:15:16 PST 2008
see http://www.digitalmars.com/d/2.0/struct.html under "Dynamic
Initialization of Structs"
Ary Borenszweig schrieb:
> Extrawurst wrote:
>>
>>
>> Ary Borenszweig schrieb:
>>> Saaa escribió:
>>>> S s = 3; // sets s.a to 3
>>>> S t = s; // sets t.a to 3, S.opCall(s) is not called
>>>
>>> opCall is used like this:
>>>
>>> S s = S(3);
>>> S t = S(s);
>>>
>>> I don't know why your first statement works. I think it's because S
>>> is just a wrapper for an int, so an int can be implicitly casted to S.
>>
>> the first statement works cause he created an opCall for S to be
>> called with just an int. the second statement doesn't call S
>> opCall(S) cause a struct assign expression just performs a memory
>> copy when S t = s; to have the second opCall called u would have to
>> write what Ary suggested: S t = S(s);
>>
>> ~Extrawurst
>
> Sorry, I didn't know that.
>
> I wanted to see where opCall is explained in the digitalmars page...
> but each time I want to search a concept, if I use search box, it
> gives me only results of the newsgroups archives. Otherwise, I have to
> guess where in the left navigation bar I have to click. Isn't there an
> index of keywords or important concepts?
More information about the Digitalmars-d-learn
mailing list