4 #ifndef ODBLIB_SHAREDITERATOR_H_
5 #define ODBLIB_SHAREDITERATOR_H_
73 if (
it_) ++(*useCount_);
88 if (
it_) ++(*useCount_);
116 return (*
it_ == *other.
it_);
122 return (*
it_ != *other.
it_);
Represents a smart iterator.
bool operator!=(const SharedIterator &other)
Compares two managed iterator objects.
long useCount() const
Returns the number of SharedIterator instances (including this) managing the same iterator object.
T::reference reference
Reference type of the managed iterator. Provided for compatibility with C++ STL algorithms.
~SharedIterator()
Destroys the managed iterator if there are no more SharedIterator instances referring to it.
T * get() const
Returns pointer to the managed iterator object.
T::value_type value_type
Value type of the managed iterator. Provided for compatibility with C++ STL algorithms.
SharedIterator & operator++()
Increments the managed iterator object.
reference operator*() const
Dereferences the managed iterator object.
bool unique() const
Checks if this is the only SharedIterator instance managing the iterator object.
T::iterator_category iterator_category
Cagegory of the managed iterator. Provided for compatibility with C++ STL algorithms.
SharedIterator(const SharedIterator< U > &other)
Creates a smart iterator which shares ownership of the iterator object managed by the other smart ite...
T::difference_type difference_type
Difference type of the managed iterator. Provided for compatibility with C++ STL algorithms.
bool operator==(const SharedIterator &other)
Compares two managed iterator objects.
pointer operator->() const
Dereferences the managed iterator object.
SharedIterator & operator=(const SharedIterator &other)
Replaces the wrapped iterator object with the one managed by other.
SharedIterator(const SharedIterator &other)
Creates a smart iterator which shares ownership of the iterator object managed by the other smart ite...
SharedIterator(U *it)
Creates a smart iterator.
T::pointer pointer
Pointer type of the managed iterator. Provided for compatibility with C++ STL algorithms.