Open CASCADE Technology  7.8.1
Public Types | Public Member Functions
NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant > Class Template Reference

Helper class that allows to use NCollection iterators as STL iterators. NCollection iterator can be extended to STL iterator of any category by adding necessary methods: STL forward iterator requires IsEqual method, STL bidirectional iterator requires Previous method, and STL random access iterator requires Offset and Differ methods. See NCollection_Vector as example of declaring custom STL iterators. More...

#include <NCollection_IndexedIterator.hxx>

Public Types

using iterator_category = Category
 
using value_type = ItemType
 
using difference_type = ptrdiff_t
 
using pointer = typename std::conditional< IsConstant, const ItemType *, ItemType * >::type
 
using reference = typename std::conditional< IsConstant, const ItemType &, ItemType & >::type
 

Public Member Functions

 NCollection_IndexedIterator ()
 Default constructor. More...
 
 NCollection_IndexedIterator (const BaseIndexedMap &theMap)
 Constructor from NCollection_Indexed*Map. More...
 
 NCollection_IndexedIterator (const size_t theIndex, const BaseIndexedMap &theMap)
 Constructor from NCollection_Indexed*Map. More...
 
 NCollection_IndexedIterator (const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, false > &theOther)
 Cast from non-const variant to const one. More...
 
NCollection_IndexedIteratoroperator= (const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, false > &theOther)
 Assignment of non-const iterator to const one. More...
 
methods related to bidirectional STL iterator
NCollection_IndexedIteratoroperator-- ()
 Prefix decrement. More...
 
NCollection_IndexedIterator operator-- (int)
 Postfix decrement. More...
 

methods related to forward STL iterator

bool operator== (const NCollection_IndexedIterator &theOther) const
 Test for equality. More...
 
template<bool theOtherIsConstant>
bool operator== (const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, theOtherIsConstant > &theOther) const
 Test for equality. More...
 
template<bool theOtherIsConstant>
bool operator!= (const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, theOtherIsConstant > &theOther) const
 Test for equality. More...
 
bool operator!= (const NCollection_IndexedIterator &theOther) const
 Test for inequality. More...
 
NCollection_IndexedIterator::reference operator* () const
 Get reference to current item. More...
 
NCollection_IndexedIterator::pointer operator-> () const
 Dereferencing operator. More...
 
NCollection_IndexedIteratoroperator++ ()
 Prefix increment. More...
 
NCollection_IndexedIterator operator++ (int)
 Postfix increment. More...
 
template<bool Condition>
std::enable_if<!Condition, ItemType & >::type Reference () const
 Test for equality. More...
 
template<bool Condition>
std::enable_if< Condition, const ItemType & >::type Reference () const
 Test for equality. More...
 

methods related to random access STL iterator

NCollection_IndexedIteratoroperator+= (typename NCollection_IndexedIterator::difference_type theOffset)
 Move forward. More...
 
NCollection_IndexedIterator operator+ (typename NCollection_IndexedIterator::difference_type theOffset) const
 Addition. More...
 
NCollection_IndexedIteratoroperator-= (typename NCollection_IndexedIterator::difference_type theOffset)
 Move backward. More...
 
NCollection_IndexedIterator operator- (typename NCollection_IndexedIterator::difference_type theOffset) const
 Decrease. More...
 
NCollection_IndexedIterator::difference_type operator- (const NCollection_IndexedIterator &theOther) const
 Difference. More...
 
NCollection_IndexedIterator::reference operator[] (typename NCollection_IndexedIterator::difference_type theOffset) const
 Get item at offset from current. More...
 
bool operator< (const NCollection_IndexedIterator &theOther) const
 Comparison. More...
 
bool operator> (const NCollection_IndexedIterator &theOther) const
 Comparison. More...
 
bool operator<= (const NCollection_IndexedIterator &theOther) const
 Comparison. More...
 
bool operator>= (const NCollection_IndexedIterator &theOther) const
 Comparison. More...
 

Detailed Description

template<class Category, class BaseIndexedMap, class ItemType, bool IsConstant>
class NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >

Helper class that allows to use NCollection iterators as STL iterators. NCollection iterator can be extended to STL iterator of any category by adding necessary methods: STL forward iterator requires IsEqual method, STL bidirectional iterator requires Previous method, and STL random access iterator requires Offset and Differ methods. See NCollection_Vector as example of declaring custom STL iterators.

Member Typedef Documentation

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
using NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::difference_type = ptrdiff_t
template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
using NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::iterator_category = Category
template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
using NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::pointer = typename std::conditional<IsConstant, const ItemType*, ItemType*>::type
template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
using NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::reference = typename std::conditional<IsConstant, const ItemType&, ItemType&>::type
template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
using NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::value_type = ItemType

Constructor & Destructor Documentation

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::NCollection_IndexedIterator ( )
inline

Default constructor.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::NCollection_IndexedIterator ( const BaseIndexedMap &  theMap)
inline

Constructor from NCollection_Indexed*Map.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::NCollection_IndexedIterator ( const size_t  theIndex,
const BaseIndexedMap &  theMap 
)
inline

Constructor from NCollection_Indexed*Map.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::NCollection_IndexedIterator ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, false > &  theOther)
inline

Cast from non-const variant to const one.

Member Function Documentation

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
template<bool theOtherIsConstant>
bool NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator!= ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, theOtherIsConstant > &  theOther) const
inline

Test for equality.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
bool NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator!= ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant > &  theOther) const
inline

Test for inequality.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator::reference NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator* ( ) const
inline

Get reference to current item.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator+ ( typename NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::difference_type  theOffset) const
inline

Addition.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator& NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator++ ( )
inline

Prefix increment.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator++ ( int  )
inline

Postfix increment.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator& NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator+= ( typename NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::difference_type  theOffset)
inline

Move forward.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator- ( typename NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::difference_type  theOffset) const
inline

Decrease.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator::difference_type NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator- ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant > &  theOther) const
inline

Difference.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator& NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator-- ( )
inline

Prefix decrement.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator-- ( int  )
inline

Postfix decrement.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator& NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator-= ( typename NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::difference_type  theOffset)
inline

Move backward.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator::pointer NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator-> ( ) const
inline

Dereferencing operator.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
bool NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator< ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant > &  theOther) const
inline

Comparison.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
bool NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator<= ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant > &  theOther) const
inline

Comparison.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator& NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator= ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, false > &  theOther)
inline

Assignment of non-const iterator to const one.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
bool NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator== ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant > &  theOther) const
inline

Test for equality.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
template<bool theOtherIsConstant>
bool NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator== ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, theOtherIsConstant > &  theOther) const
inline

Test for equality.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
bool NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator> ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant > &  theOther) const
inline

Comparison.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
bool NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator>= ( const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant > &  theOther) const
inline

Comparison.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
NCollection_IndexedIterator::reference NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::operator[] ( typename NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::difference_type  theOffset) const
inline

Get item at offset from current.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
template<bool Condition>
std::enable_if<!Condition, ItemType&>::type NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::Reference ( ) const
inlineprotected

Test for equality.

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
template<bool Condition>
std::enable_if<Condition, const ItemType&>::type NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::Reference ( ) const
inlineprotected

Test for equality.


The documentation for this class was generated from the following file: