Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions
NCollection_StlIterator< Category, BaseIterator, 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_DynamicArray as example of declaring custom STL iterators. More...

#include <NCollection_StlIterator.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_StlIterator ()=default
 Default constructor.
 
 NCollection_StlIterator (const BaseIterator &theIterator)
 Constructor from NCollection iterator.
 
 NCollection_StlIterator (const NCollection_StlIterator< Category, BaseIterator, ItemType, false > &theIterator)
 Cast from non-const variant to const one.
 
NCollection_StlIteratoroperator= (const NCollection_StlIterator< Category, BaseIterator, ItemType, false > &theIterator)
 Assignment of non-const iterator to const one.
 
const BaseIteratorIterator () const noexcept
 Access to NCollection iterator instance.
 
BaseIteratorChangeIterator () noexcept
 Access to NCollection iterator instance.
 
methods related to bidirectional STL iterator

Prefix decrement

NCollection_StlIteratoroperator-- ()
 Postfix decrement.
 
NCollection_StlIterator operator-- (int)
 Postfix decrement.
 

methods related to random access STL iterator

Move forward

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

methods related to forward STL iterator

Test for equality

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

Detailed Description

template<class Category, class BaseIterator, class ItemType, bool IsConstant>
class NCollection_StlIterator< Category, BaseIterator, 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_DynamicArray as example of declaring custom STL iterators.

Member Typedef Documentation

◆ difference_type

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
using NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::difference_type = ptrdiff_t

◆ iterator_category

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
using NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::iterator_category = Category

◆ pointer

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
using NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::pointer = typename std::conditional<IsConstant, const ItemType*, ItemType*>::type

◆ reference

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
using NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::reference = typename std::conditional<IsConstant, const ItemType&, ItemType&>::type

◆ value_type

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
using NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::value_type = ItemType

Constructor & Destructor Documentation

◆ NCollection_StlIterator() [1/3]

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::NCollection_StlIterator ( )
default

Default constructor.

◆ NCollection_StlIterator() [2/3]

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::NCollection_StlIterator ( const BaseIterator & theIterator)
inline

Constructor from NCollection iterator.

◆ NCollection_StlIterator() [3/3]

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::NCollection_StlIterator ( const NCollection_StlIterator< Category, BaseIterator, ItemType, false > & theIterator)
inline

Cast from non-const variant to const one.

Member Function Documentation

◆ ChangeIterator()

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
BaseIterator & NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::ChangeIterator ( )
inlinenoexcept

Access to NCollection iterator instance.

◆ Iterator()

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
const BaseIterator & NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::Iterator ( ) const
inlinenoexcept

Access to NCollection iterator instance.

◆ operator!=()

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

Test for inequality.

◆ operator*()

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

Get reference to current item.

◆ operator+()

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

Addition.

◆ operator++() [1/2]

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

Prefix increment.

◆ operator++() [2/2]

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

Postfix increment.

◆ operator+=()

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

NCollection iterator.

◆ operator-() [1/2]

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

Difference.

◆ operator-() [2/2]

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

Decrease.

◆ operator--() [1/2]

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

Postfix decrement.

◆ operator--() [2/2]

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

Postfix decrement.

◆ operator-=()

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

Move backward.

◆ operator->()

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

Dereferencing operator.

◆ operator<()

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

Comparison.

◆ operator<=()

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

Comparison.

◆ operator=()

template<class Category , class BaseIterator , class ItemType , bool IsConstant>
NCollection_StlIterator & NCollection_StlIterator< Category, BaseIterator, ItemType, IsConstant >::operator= ( const NCollection_StlIterator< Category, BaseIterator, ItemType, false > & theIterator)
inline

Assignment of non-const iterator to const one.

◆ operator==()

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

Test for inequality.

◆ operator>()

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

Comparison.

◆ operator>=()

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

Comparison.

◆ operator[]()

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

Get item at offset from current.

◆ Reference() [1/2]

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

Test for inequality.

◆ Reference() [2/2]

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

Test for inequality.


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