What is the correct use of auto?

Scott S. McCoy tag at cpan.org
Sun Apr 13 21:01:21 PDT 2008


On Fri, 2008-04-11 at 03:01 -0400, Sean Reque wrote:
> auto is also a very handy syntactic sugar when the type of the object
> you are declaring is very long.

Like:

NonblockingThreadsafeQueue!(QueueItem!(TimedEventPriorty,bool
delegate())) foo = object.getQueue();

... it looks a lot nicer as...

auto foo = object.getQueue(); /* Especially since it has to be obvious
to the compiler what you're asking for, so it must be defined someplace
*/





More information about the Digitalmars-d mailing list