.TH "FBB::Iterator" "3bobcat" "2005\-2023" "libbobcat\-dev_6\&.04\&.00" "Iterator returning plain values" .PP .SH "NAME" FBB::Iterator \- Iterator returning plain values when dereferenced .PP FBB::ReverseIterator \- reverse_iterator for \fBFBB::Iterator\fP .PP .SH "SYNOPSIS" \fB#include \fP .br .PP .SH "DESCRIPTION" .PP The \fBFBB::Iterator\fP class template implements a bidirectional iterator for plain data types\&. Dereferencing \fBFBB::Iterator\fP objects returns values of type \fBType\fP, e\&.g\&., \fIchar\fP or \fIint\fP\&. This iterator comes in handy in case you need to initialize an objects with a range of values, which are of some basic type (see also the \fBEXAMPLE\fP section)\&. .PP \fBFBB::ReverseIterator\fP implements a reverse iterator for \fBFBB::Iterator\fP\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \fIstd::iterator\fP .PP .SH "CONSTRUCTORS" .PP Constructors for \fBIterator\fP: .IP o \fBexplicit Iterator(Tye const &value)\fP: .br This constructor initializes the \fBIterator\fP object with an initial \fIType\fP value\&. When dereferencing this iterator, \fIvalue\fP is returned\&. .PP The \fBIterator\fP\(cq\&s default, copy, and move constructors (and its copy and move assignment operators) are available\&. .PP Constructors for \fBReverseIterator\fP: .IP o \fBexplicit ReverseIterator(Type const &value)\fP: .br This constructor initializes the \fBReverseIterator\fP object with an initial \fIType\fP value\&. When dereferencing this iterator immediately following its construction, the decremented \fIvalue\fP is returned (without modifying the internally stored \fIType value\fP); .IP .IP o \fBexplicit ReverseIterator(Iterator const &iter)\fP: .br This constructor initializes the \fBReverseIterator\fP object with an initial \fIIterator\fP object\&. When dereferencing this iterator immediately following its construction, the decremented \fBIterator\fP\(cq\&s \fIvalue\fP is returned (without modifying the \fIType value\fP that is stored inside the \fBIterator\fP)\&. .PP The \fBReverseIterator\fP\(cq\&s default, copy, and move constructors (and its copy and move assignment operators) are available\&. .PP .SH "MEMBER FUNCTIONS" For template parameter type \fIType\fP all members of \fIstd::iterator\fP are available, as \fBFBB::Iterator\fP and \fBFBB::ReverseIterator\fP inherit from this class\&. .PP .IP o \fBIterator &operator++()\fP: .br The (prefix) increment operator increments the iterator\(cq\&s value and returns a reference to itself; .IP .IP o \fBIterator &operator++(int)\fP: .br The (postfix) increment operator increments the iterator\(cq\&s value and returns a copy of itself, initialized with the iterator\(cq\&s value before it was incremented; .IP .IP o \fBIterator &operator\-\-()\fP: .br The (prefix) decrement operator decrements the iterator\(cq\&s value and returns a reference to itself; .IP .IP o \fBIterator &operator\-\-(int)\fP: .br The (postfix) decrement operator decrements the iterator\(cq\&s value and returns a copy of itself, initialized with the iterator\(cq\&s value before it was decremented; .IP .IP o \fBbool operator==(Iterator const &rhs) const\fP: .br This operator returns \fItrue\fP if the value of the current \fBIterator\fP object is equal to the value of the \fIrhs\fP \fBIterator\fP object; .IP .IP o \fBbool operator!=(Iterator const &rhs) const\fP: .br This operator returns \fItrue\fP if the value of the current \fBIterator\fP object is not equal to the value of the \fIrhs\fP \fBIterator\fP object; .IP .IP o \fBType &operator*()\fP: .br The derefence operator returns a reference to the \fBIterator\fP\(cq\&s value\&. .IP .IP o \fBType const &operator*() const\fP: .br This derefence operator returns a reference to the \fBIterator\fP\(cq\&s immutable value\&. .PP .SH "STATIC MEMBER FUNCTIONS" .PP Static members of \fBIterator\fP: .IP o \fBIterator last(Type value)\fP: .br An \fBIterator\fP object is returned initialized with \fI++value\fP, so it can be conveniently be used to create an inclusive iterator range (see also section \fBEXAMPLE\fP); .IP .IP o \fBIterator max()\fP: .br An \fBIterator\fP object is returned initialized with the value returned by \fIstd::numeric_limits::max()\fP; .IP .IP o \fBIterator min()\fP: .br An \fBIterator\fP object is returned initialized with the value returned by \fIstd::numeric_limits::min()\fP .PP Static member of \fBReverseIterator\fP: .IP o \fBReverseIterator last(Type const &value)\fP: .br A \fBReverseIterator\fP object is returned initialized with \fBIterator::last(value)\fP, so it can be conveniently be used to create an inclusive reverse iterator range (see also section \fBEXAMPLE\fP); .PP .SH "EXAMPLE" .nf #include #include #include #include #include using namespace std; using namespace FBB; int main() { copy(Iterator(10), Iterator(20), ostream_iterator(cout, \(dq\&, \(dq\&)); cout << \(cq\&\en\(cq\&; copy(Iterator(*Iterator::max() \- 9), Iterator::last(*Iterator::max()), ostream_iterator(cout, \(dq\&, \(dq\&)); cout << \(cq\&\en\(cq\&; cout << *Iterator::max() << \(cq\&\en\(cq\&; copy(Iterator(*Iterator::max() \- 9), Iterator::last(*Iterator::max()), ostream_iterator(cout, \(dq\&, \(dq\&)); cout << \(cq\&\en\(cq\&; copy(ReverseIterator(20), ReverseIterator(10), ostream_iterator(cout, \(dq\&, \(dq\&)); cout << \(cq\&\en\(cq\&; std::string letters(Iterator(\(cq\&a\(cq\&), Iterator::last(\(cq\&z\(cq\&)); cout << letters << \(cq\&\en\(cq\&; std::string caps(ReverseIterator::last(\(cq\&Z\(cq\&), ReverseIterator(\(cq\&A\(cq\&)); cout << caps << \(cq\&\en\(cq\&; } .fi .PP .SH "FILES" \fIbobcat/iterator\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7) .PP .SH "BUGS" None Reported\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_6\&.04\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_6\&.04\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_6\&.04\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP