OEIter
template<class A>
class OEIter
This class represents OEIter.
The OEIter template class is used to represent
iterator functionality. The template is parameterized over
class A, defining the behavior of iterators of across collections
of type A. The iterator can be thought of a behaving like a pointer
to type A.
OEIters are typically initialized by assigning
them the value of an OEIterBase(of compatible type T),
return from a function.
Constructors
OEIter()
OEIter(OEIterBase<A>* rhs)
OEIter(const OEIter<A>& rhs)
OEIter(OEIterBase<NonConstA>* rhs)
template<typename P>
OEIter(const P& pred, OEIter<A>& rhs)
template<typename P>
OEIter(const P& pred, OEIterBase<A>* rhs)
Default and copy constructors.
operator->
A* operator->() const
Dereferences the iterator as a pointer. This operator returns a pointer to the current item pointed to by the iterator.
operator bool
operator bool() const
Returns true if the current iterator position is valid. This should typically be checked before each dereference of an iterator.
Copy
OEIterBase<A> *Copy() const
Copies an OEIter. The returned value is a newly allocated OEIterBase <A>* that should be immediately assigned to an OEIter. The current location in the iterator is preserved by the copy.
Push
void Push(OEIter<A> &iter)
void Push(OEIterBase<A> *ib)
template<typename F>
void Push(const F &pred)
Sort
void Sort(const OESystem::OEBinaryPredicate<A, A> &sort_criterion)
Sorts contents of the iterator and resets the iterator to its first item. The re-ordering is local to the given instance of the iterator (i.e., the container holding the items the iterator traverses is unchanged). Once this function is called the iterator is never delete safe, even if it normally would be.
The OEBinaryPredicate <A,A> passed
to this function is used as
the less comparison in the sort. It should return true if the
first argument is less than the second argument and false
otherwise. An item that is less than another item will appear
first after sorting.
ToFirst
OEIter<A> &ToFirst()
Resets the iterator to its first item, if possible.
ToLast
OEIter<A> &ToLast()
Resets the iterator to its last item, if possible.