Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-07-29 21:15:36


Thomas Witt wrote:
> Is there a specific reason that MPL supplies
> template<class> struct select1st/2nd; instead of
> template<class, int> struct select;
>
> The latter seems more general and scalable to me.

But pairs have only two elements, don't they? :). 'select1st/2nd' are
compile counterparts of SGI STL's run-time components of the same names.
They exist mostly to make STL programmers to feel themselves at home ;).
They work with pairs only, and they don't need a generalization, because a
generic way to access an element in more than a 2-element container already
exists - 'template< typename N, typename Sequence > struct at;'.

On a slightly aside note, may be it would make sense to make a pair a
full-fledged sequence (so, among other things, you could pass it to 'at');
at very little cost we would have one more sequence to play with :).

Aleksey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk