Open CASCADE Technology 7.8.0
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.
 
 NCollection_IndexedIterator (const BaseIndexedMap &theMap)
 Constructor from NCollection_Indexed*Map.
 
 NCollection_IndexedIterator (const size_t theIndex, const BaseIndexedMap &theMap)
 Constructor from NCollection_Indexed*Map.
 
 NCollection_IndexedIterator (const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, false > &theOther)
 Cast from non-const variant to const one.
 
NCollection_IndexedIteratoroperator= (const NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, false > &theOther)
 Assignment of non-const iterator to const one.
 
methods related to bidirectional STL iterator
NCollection_IndexedIteratoroperator-- ()
 Prefix decrement.
 
NCollection_IndexedIterator operator-- (int)
 Postfix decrement.
 

methods related to random access STL iterator

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

methods related to forward STL iterator

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

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

◆ difference_type

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
using NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::difference_type = ptrdiff_t

◆ iterator_category

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
using NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::iterator_category = Category

◆ pointer

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

◆ reference

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

◆ value_type

template<class Category , class BaseIndexedMap , class ItemType , bool IsConstant>
using NCollection_IndexedIterator< Category, BaseIndexedMap, ItemType, IsConstant >::value_type = ItemType

Constructor & Destructor Documentation

◆ NCollection_IndexedIterator() [1/4]

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

Default constructor.

◆ NCollection_IndexedIterator() [2/4]

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.

◆ NCollection_IndexedIterator() [3/4]

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.

◆ NCollection_IndexedIterator() [4/4]

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

◆ operator!=() [1/2]

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.

◆ operator!=() [2/2]

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.

◆ operator*()

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.

◆ operator+()

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.

◆ operator++() [1/2]

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

Prefix increment.

◆ operator++() [2/2]

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

Postfix increment.

◆ operator+=()

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.

◆ operator-() [1/2]

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.

◆ operator-() [2/2]

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.

◆ operator--() [1/2]

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

Prefix decrement.

◆ operator--() [2/2]

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

Postfix decrement.

◆ operator-=()

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.

◆ operator->()

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

Dereferencing operator.

◆ 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.

◆ 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.

◆ operator=()

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.

◆ operator==() [1/2]

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.

◆ operator==() [2/2]

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.

◆ 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.

◆ 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.

◆ operator[]()

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.

◆ Reference() [1/2]

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.

◆ Reference() [2/2]

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

Test for equality.


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