Different types with auto

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 17 17:30:30 PDT 2011


On 3/17/11 7:27 PM, KennyTM~ wrote:
> On Mar 18, 11 04:17, Jason E. Aten wrote:
>>> auto x1=1., x2=2., x3=3., x4=4., x5=5, x6=6.;
>>
>> If the coder wanted them to all be doubles, it's easy to require that by
>> just saying so, and then even x5 will be a double.
>>
>> double x1=1., x2=2, ...
>>
>> So it seems to me that auto does exactly what you asked it to here, and I
>> actually prefer this behavior for conciseness and expressiveness sake.
>>
>
> auto x1 = templateFunctionWithComplicatedReturnType("a"),
> x2 = templateFunctionWithComplicatedReturnType("b"),
> x3 = templateFunctionWithComplicatedReturnType('c'),
> x4 = templateFunctionWithComplicatedReturnType("d");

Yah, not sure what would ever be bad about that.

Andrei


More information about the Digitalmars-d mailing list