|
Boost : |
From: François Duranleau (duranlef_at_[hidden])
Date: 2007-08-09 18:34:00
On Thu, 9 Aug 2007, Joseph Gauterin wrote:
> I think the names 'key_iterator'/'value_iterator' are clearer than
> 'get_iterator', but I can see how the functionality of being able to
> select any element of a tuple could be useful.
>
> Perhaps we could merge the two concepts and have
> 'make_key_iterator'/'make_value_iterator' call
> 'make_get_iterator<1>'/'make_get_iterator<2> respectively.
Yes, I said that.
> While we could do that with the helper functions, unfortunately for
> the classes, without template typedefs we can't have
> 'get_iterator<X,1>' be the same as 'key_iterator<X>' and having two
> classes doing the same thing seems like a bit of a cludge (I suppose
> std::pair/std::tr1::tuple<X,Y> gives us precendent, but it still
> doesn't seem right).
How about:
template < typename Iterator >
class key_iterator : public get_iterator< Iterator , 0 >
{
public :
key_iterator() {}
key_iterator( const Iterator& i )
: get_iterator< Iterator , 0 >( i )
{
}
} ;
And something similar for value_iterator?
-- François Duranleau LIGUM, Université de Montréal
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk