auto

Peter Alexander peter.alexander.au at gmail.com
Sat Nov 26 05:11:24 PST 2011


On 24/11/11 10:38 PM, Andrej Mitrovic wrote:
> But I bet you would waste more memory at compile-time if you had to
> type a long template instance name instead of using auto. We're
> talkin' bytes here!

Actually, using `auto` should be faster because the compiler doesn't 
need to do any name lookup.

auto x = foo(); // deduce type of Foo and use that

Foo x = foo(); // find out what 'Foo' refers to, but also deduce type of 
foo() and then do type checking.


More information about the Digitalmars-d-learn mailing list