Classes in D and C++
Sean Kelly
sean at f4.ca
Mon Mar 5 07:58:37 PST 2007
Uno wrote:
>> You can do:
>>
>> auto x = X(3);
>>
>> and x will be put on the stack.
>
> I didn't know that shortcut.. thanks! Now it looks much better and it's acceptable for me, but c++ form is still shorter and more elegant (of course it's disputable).
The problem with the C++ form is that it's semantically identical to a
function prototype statement. I do think it would be great if there
were a common syntax to construct all types in D, but I'm not sure if "X
x(a)" is it. "X x = X(a)" is probably better. But I'd like this to
work for concrete types as well.
Sean
More information about the Digitalmars-d
mailing list