Comment on PEP-0322: Reverse Iteration Methods

David Abrahams dave at boost-consulting.com
Sun Sep 28 11:22:11 EDT 2003


Stephen Horne <$$$$$$$$$$$$$$$$$@$$$$$$$$$$$$$$$$$$$$.co.uk> writes:

>>Sorry, what specialization?
>
> Presumably template specialisation - such that the special case of
> std::pair<T,T> picks up the iterating functionality that
> std::pair<T,U> lacks (begin, end etc). That is what I thought you were
> saying.
>
> Or am I still getting this wrong?

Yeah, slightly.  You don't need a begin() member function in order to
make an iterator.  The interface might look like:

  std::for_each(pair_iterator<T>(my_pair), pair_iterator<T>(), f);

Decoupling is the way to go, man! :^)

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Python-list mailing list