toast iterator library


Detailed Description

This module has a few iterator adaptors we use to hide some details from our iterfaces. A motivating example would be a class which presented an iterator interface to some contents. The contents were held directly in a vector, so we just typedefed the vector's iterators and exposed those. That was fine for a while, until we needed to be able to look up the contents with a Key. We could have done some kind of multi-index, or just added a map with pointers into the vector. Instead we changed the vector to a map, and used the toast::second_iterator to hide the details from clients.

Also available are the toast::dereference_iterator and the toast::first_iterator.


Files

file  dereference_iterator.hpp
 This file contains the toast::dereference_iterator.
file  first_iterator.hpp
 This file contains the toast::first_iterator.
file  second_iterator.hpp
 This file contains the toast::second_iterator.

Classes

class  toast::dereference_iterator< Iterator >
 turns iterators to pointers into iterators to pointees. More...
class  toast::first_iterator< Iterator >
 Turns iterators to pairs into iterators to pair.first values. More...
class  toast::second_iterator< Iterator >
 Turns iterators to pairs into iterators to pair.second values. More...

Functions

template<typename Iterator>
dereference_iterator< Iterator > toast::make_dereference_iterator (Iterator i)
 convenience function to make a dereference iterator.
template<typename Iterator>
first_iterator< Iterator > toast::make_first_iterator (Iterator i)
 Convenience function for making first iterators.
template<typename Iterator>
second_iterator< Iterator > toast::make_second_iterator (Iterator i)
 Convenience function for making second iterators.


SourceForge.net Logo