|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-10-12 23:23:09
Lewis Hyatt <lhyatt_at_[hidden]> writes:
> The idea is to define a template class,
>
> template<typename Iterator> class first_iterator_t {
> Iterator pair_iter;
> public:
> first_iterator_t(Iterator const&);
> /*...*/
> };
>
> which overloads operator*() and operator->() to access the element named
> "first" of the object returned by Iterator::operator*(). (With something
> analagous for second_iterator_t.) A function named first_iterator()
> provides a convenient creation function a-la std::make_pair().
Sounds like a job for transform_iterator.
http://www.boost.org/libs/iterator/doc/transform_iterator.html
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk