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

Lois Goldthwaite lois at loisgoldthwaite.com
Tue Oct 26 19:58:25 EDT 2004


On Tuesday 26 October 2004 15:53, Terje Slettebø wrote:
> >Adrian Fagg <adrianf at evaluategroup.com>:
> > 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. :)

As a general principle, the C++ committee strongly favours library solutions 
over unnecessary core language changes. 

1) A library solution can be put to work almost immediately (even if the 
programmer has to write a home-grown version of it). Core language changes 
take several years to percolate to the customer.

2) The core language is so complex and interdependent that changing the 
compiler in one area is likely to destabilise support for some other bit of 
it. 

Having said that, the really interesting issues are at the boundary where the 
core language and the standard library are both involved. So yes, core 
changes are being discussed, but certainly not just for the sake of changing 
the language.

> 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?)

Without the templates used in the library, std::complex would be several 
built-in types, as it is in C: complex_float, complex_double, etc. And those 
types would be all that you could use. The library is extensible.

Lois




More information about the Effective-cpp mailing list