simple struct template
Hendrik Renken
funsheep at gmx.net
Fri Mar 30 08:29:01 PDT 2007
Frits van Bommel wrote:
> Hendrik Renken wrote:
>> how do i overload opCall, when i want to return the appropriate type,
>> i tried the obvious (at least for me):
>>
>>
>> struct Vector(T)
>> {
>>
>> public: T x, y, z;
>> static Vector!(T) opCall(T x, T y, T z)
>> {
>> this.x, y, z = (x, y, z);
>
> change that to:
> Vector!(T) result;
> result.x = x;
> result.y = y;
> result.z = z;
> return result;
>
> Static member function don't _have_ a "this"
>
> Because you didn't actually return anything.
*banging the head against the table*
seems, as if my brain takes a long nap. sorry for bothering.
More information about the Digitalmars-d-learn
mailing list