I'd just like to say thanks for D

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Mar 11 07:31:00 PDT 2013


On Mon, Mar 11, 2013 at 07:13:32AM +0100, Lars T. Kyllingstad wrote:
> On Monday, 11 March 2013 at 05:24:34 UTC, H. S. Teoh wrote:
> >- Ahem. Next, the compiler complains, "you wrote a template name with
> >  no parameters; that's illegal!" Perfectly legal complaint, but the
> >  line concerned read:
> >
> >	std::unordered_map::iterator it = fcache.find(key);
> >
> >  Fixing the compiler error required me to change this
> >  already-verbose line to:
> >
> >	std::unordered_map<cache_key_type, vertex_set>::iterator it = fcache.find(key);
> >
> >  Argh! What is this, Java?! How I miss D's type inference... The
> >  only way to make this *not* painful was to use a typedef.
> 
> Tip: Since you've already enabled C++11 extensions, you could just
> do:
> 
>     auto it = fcache.find(key);
> 
> It... it... almost looks like D? :)
> 
> IMO, the redefinition of 'auto' to mean type inference is the
> biggest improvement in C++11.
[...]

Hmm, no kidding! That certainly does make things a lot more readable.
But ... all things considered, this feels like too little, too late. D
has trumped C++ in so many ways that it's just not worth the effort in
this particular case.


T

-- 
It is the quality rather than the quantity that matters. -- Lucius Annaeus Seneca


More information about the Digitalmars-d mailing list