[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
IteratorAdaptor< Policy > Class Template Reference |
Quickly create 1-dimensional iterator adapters. More...
#include <vigra/iteratoradapter.hxx>
Public Member Functions | |
IteratorAdaptor (BaseType const &o) | |
Quickly create 1-dimensional iterator adapters.
This class supports the easy creation of 1D iterator adapters out of existing iterators. To use it, you must first implement a policy class that defines the iterator's behavior. The policy is used to instantiate the IteratorAdapter template, which thus automatically obtains all required functions of an STL-compatible iterator. General information on how this works can be found on the Boost Iterator Adaptor page, although there are some differences in the details of the boost and VIGRA implementations. Here is an example policy class that just exports the behaviour of the underlying iterator:
This policy class is used like this:
By changing the definition of the policy members, a wide range of adaptor behaviors can be achieved. If the base iterator isn't a random access iterator, just drop the functions that cannot be implemented. This simply means that some adaptor functions may not be called, as one would expect from an iterator that doesn't support random access. Note also that the BaseType
needs not be an iterator - it can be any type that contains the information necessary for the adaptor to do it's work.
#include <vigra/iteratoradapter.hxx>
Namespace: vigra
|
explicit |
Construct from an instance of the policy class' BaseType Note that the functions of the adaptor implement the interface of an random access iterator as defined in the C++ standard, so there is no need for explicit documentation.
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|