FBB::PtrIter - Iterator returning pointer when dereferenced
SYNOPSIS
#include <bobcat/ptriter>
DESCRIPTION
The PtrIter class template implements an input iterator whose
operator* returns the address of the element the iterator refers to.
Consider a std::unordered_map<std::string, DataType>. Its begin member
returns an iterator whose operator* returns a std::pair<std::string,
DataType> (const) &. This is usually what you want, but now assume we want to
display the map's contents, sorted by its keys. Sorting can simply be
performed by defining a support vector containing pointers to the elements in
the map, and then sorting the strings the pointers point at.
PtrIter is a tool that can be used to construct such a support vector, as
shown in the EXAMPLE section.
PtrIter is a class template requiring one template type parameter:
Iterator, the iterator's type (e.g., vector<string>::iterator)
PtrIter's users don't have to specify PtrIter's template type. The
function template ptrIter, when provided with an iterator returns the
matching PtrIter object.
NAMESPACE
FBB
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace FBB.
INHERITS FROM
std::iterator<std::input_iterator_tag, ...>
FREE FUNCTION
PtrIter<Iterator> ptrIter(Iterator const &iter):
this function template returns a PtrIter object for the function's
Iterator argument. This function template simplyfies the construction of a
PtrIter as no template parameters need to be specified (see also the
EXAMPLE section)
CONSTRUCTORS
PtrIter(Iterator const &iter):
The iter parameter must be initialized with an existing input
iterator, offering operator*, operator++, operator== and operator!=.
As PtrIter is a class template, its template type parameters must be
specified when defining a PtrIter object. E.g.,