Different types with auto

KennyTM~ kennytm at gmail.com
Thu Mar 17 17:27:09 PDT 2011


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");


More information about the Digitalmars-d mailing list