[Effective-cpp] Item 1: Uses and Abuses of vector

Terje Slettebø tslettebo at broadpark.no
Tue Oct 26 10:53:36 EDT 2004


>Adrian Fagg <adrianf at evaluategroup.com>:

> > Eh? Lambda doesn't improve _readability_ and certainly isn't
> > intuitive. :-)
> 
> I agree, Lambda is a marvellous use of templates but I'd far rather the
> language supported it directly.

How would you like this language support to look like? I.e. how would you write
my for_each() example, with language support for lambda functions?

> I know I'm in a minority here but I don't agree with the consensus that all
> future enhancements should be in the standard libraries and not direct
> support for e.g. nested functions etc.

I didn't know there was consensus about this (and I'd think the core and
evolution working groups would be rather surprised by it, as well, since they
work on core language changes for C++0x. :) ), and in any case, I'm in violent
agreement with you. :)

> Nor am I convinced that there's much point in expecting everyday programming
> to be using frankly unreadable templated functors with binding etc. If it's
> so good, lets have language support.

My (admittably) simple example didn't use any binders, at all. Sure, for more
complex expressions, you may need them for Boost.Lambda, but I think the
argument against the argument that if something can be done in the library, it
should be done in the library is a strawman, because I don't think anyone
claims this. If it can be done _well_ in the library, perhaps, and you may
agree? (In other words, would you prefer std::complex to be a built-in type, or
a library-provided one, for example?)

Regards,

Terje



More information about the Effective-cpp mailing list