1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
includefile(include/header)
COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::PtrIter)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
(Iterator pointing to pointers)
manpagename(FBB::PtrIter)(Iterator returning pointer when dereferenced )
manpagesynopsis()
bf(#include <bobcat/ptriter>)nl()
manpagedescription()
The tt(PtrIter) class template implements an input iterator whose
tt(operator*) returns the address of the element the iterator refers to.
Consider a tt(std::unordered_map<std::string, DataType>). Its tt(begin) member
returns an iterator whose tt(operator*) returns a tt(std::pair<std::string,
DataType> (const) &). This is usually what you want, but now assume we want to
display the map's content, 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.
tt(PtrIter) is a tool that can be used to construct such a support vector, as
shown in the bf(EXAMPLE) section.
tt(PtrIter) is a class template requiring one template type parameter:
tt(Iterator), the iterator's type (e.g., tt(vector<string>::iterator))
tt(PtrIter)'s users don't have to specify tt(PtrIter)'s template type. The
function template tt(ptrIter), when provided with an iterator returns the
matching tt(PtrIter) object.
includefile(include/namespace)
manpagesection(INHERITS FROM)
tt(std::iterator<std::input_iterator_tag, ...>)
manpagesection(FREE FUNCTION)
itemization(
itb(PtrIter<Iterator> ptrIter(Iterator const &iter))
this function template returns a tt(PtrIter) object for the function's
tt(Iterator) argument. This function template simplyfies the construction of a
tt(PtrIter) as no template parameters need to be specified (see also the
bf(EXAMPLE) section)
)
manpagesection(CONSTRUCTORS)
itemization(
itb(PtrIter(Iterator const &iter))
The tt(iter) parameter must be initialized with an existing input
iterator, offering tt(operator*, operator++, operator==) and tt(operator!=).
As tt(PtrIter) is a class template, its template type parameters must be
specified when defining a tt(PtrIter) object. E.g.,
verb(
PtrIter<set<string>::iterator> PtrIter(mySet.begin());
)
)
Copy and move constructors (and assignment operators) are available.
manpagesection(OVERLOADED OPERATORS)
itemization(
itb(PtrType operator*() const)
the address of the entity the iterator refers to is returned;
itb(PtrIter &operator++())
the iterator is (pre)incremented to the next position;
itb(bool operator==(PtrIter const &other) const)
tt(true) is returned if the two iterators are equal;
itb(bool operator!=(PtrIter const &other) const)
tt(true) is returned if the two iterators are unequal;
)
manpagesection(DEFINED TYPE)
tt(PtrIter) defines the following type:
itemization(
itb(typedef decltype(&*Iterator()) PtrType)
)
manpagesection(MEMBER FUNCTIONS)
All members of tt(std::iterator<std:::input_iterator_tag, ...>) are
available, as bf(FBB::PtrIter) inherits from this class.
manpagesection(EXAMPLE)
verbinclude(../../ptriter/driver/driver.cc)
manpagefiles()
em(bobcat/ptriter) - defines the class interface
manpageseealso()
bf(bobcat)(7)
manpagebugs()
None Reported.
includefile(include/trailer)
|