BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlc::CompactedArray_ConstIterator< TYPE > Class Template Reference

#include <bdlc_compactedarray.h>

Public Types

typedef bsl::ptrdiff_t difference_type
 
typedef bsl::size_t size_type
 
typedef TYPE value_type
 
typedef TYPE * pointer
 
typedef TYPE & reference
 
typedef std::random_access_iterator_tag iterator_category
 

Public Member Functions

 CompactedArray_ConstIterator ()
 
 CompactedArray_ConstIterator (const CompactedArray_ConstIterator &original)
 
 ~CompactedArray_ConstIterator ()=default
 
CompactedArray_ConstIteratoroperator= (const CompactedArray_ConstIterator &rhs)
 
CompactedArray_ConstIteratoroperator+= (bsl::ptrdiff_t offset)
 
CompactedArray_ConstIteratoroperator-= (bsl::ptrdiff_t offset)
 
CompactedArray_ConstIteratoroperator++ ()
 
CompactedArray_ConstIteratoroperator-- ()
 
const TYPE & operator* () const
 
const TYPE & operator-> () const
 
const TYPE & operator[] (bsl::ptrdiff_t offset) const
 

Friends

class CompactedArray< TYPE >
 
CompactedArray_ConstIterator operator++ (CompactedArray_ConstIterator &, int)
 
CompactedArray_ConstIterator operator-- (CompactedArray_ConstIterator &, int)
 
bool operator== (const CompactedArray_ConstIterator &, const CompactedArray_ConstIterator &)
 
bool operator!= (const CompactedArray_ConstIterator &, const CompactedArray_ConstIterator &)
 
CompactedArray_ConstIterator< TYPE > operator+ (const CompactedArray_ConstIterator< TYPE > &, bsl::ptrdiff_t)
 
CompactedArray_ConstIterator< TYPE > operator- (const CompactedArray_ConstIterator< TYPE > &, bsl::ptrdiff_t)
 
bsl::ptrdiff_t operator- (const CompactedArray_ConstIterator &, const CompactedArray_ConstIterator &)
 
bool operator< (const CompactedArray_ConstIterator &, const CompactedArray_ConstIterator &)
 
bool operator<= (const CompactedArray_ConstIterator &, const CompactedArray_ConstIterator &)
 
bool operator> (const CompactedArray_ConstIterator &, const CompactedArray_ConstIterator &)
 
bool operator>= (const CompactedArray_ConstIterator &, const CompactedArray_ConstIterator &)
 

Detailed Description

template<class TYPE>
class bdlc::CompactedArray_ConstIterator< TYPE >

This value-semantic class represents a random access iterator providing non-modifiable access to the elements of a CompactedArray. This class provides all functionality of a random access iterator, as defined by the standard, but is not compatible with most standard methods requiring a bidirectional const_iterator.

This class does not perform any bounds checking. Any iterator, it, referencing a CompactedArray array, remains valid while 0 <= it - array.begin() < array.length().

See bdlc_compactedarray

Member Typedef Documentation

◆ difference_type

template<class TYPE >
typedef bsl::ptrdiff_t bdlc::CompactedArray_ConstIterator< TYPE >::difference_type

◆ iterator_category

template<class TYPE >
typedef std::random_access_iterator_tag bdlc::CompactedArray_ConstIterator< TYPE >::iterator_category

◆ pointer

template<class TYPE >
typedef TYPE* bdlc::CompactedArray_ConstIterator< TYPE >::pointer

◆ reference

template<class TYPE >
typedef TYPE& bdlc::CompactedArray_ConstIterator< TYPE >::reference

◆ size_type

template<class TYPE >
typedef bsl::size_t bdlc::CompactedArray_ConstIterator< TYPE >::size_type

◆ value_type

template<class TYPE >
typedef TYPE bdlc::CompactedArray_ConstIterator< TYPE >::value_type

Constructor & Destructor Documentation

◆ CompactedArray_ConstIterator() [1/2]

template<class TYPE >
bdlc::CompactedArray_ConstIterator< TYPE >::CompactedArray_ConstIterator ( )
inline

Create a default CompactedArray_ConstIterator. Note that the behavior of most methods is undefined when used on a default-constructed iterator.

◆ CompactedArray_ConstIterator() [2/2]

template<class TYPE >
bdlc::CompactedArray_ConstIterator< TYPE >::CompactedArray_ConstIterator ( const CompactedArray_ConstIterator< TYPE > &  original)
inline

Create a CompactedArray_ConstIterator having the same value as the specified original object.

◆ ~CompactedArray_ConstIterator()

template<class TYPE >
bdlc::CompactedArray_ConstIterator< TYPE >::~CompactedArray_ConstIterator ( )
default

Member Function Documentation

◆ operator*()

template<class TYPE >
const TYPE & bdlc::CompactedArray_ConstIterator< TYPE >::operator* ( ) const
inline

Return a const reference to the element referenced by this iterator. The behavior is undefined unless for this iterator, referencing a CompactedArray array, CompactedArray_ConstIterator() != *this and *this - array.begin() < array.length().

◆ operator++()

template<class TYPE >
CompactedArray_ConstIterator< TYPE > & bdlc::CompactedArray_ConstIterator< TYPE >::operator++ ( )
inline

Advance this iterator to refer to the next location in the referenced array, and return a reference to this iterator after the advancement. The returned iterator, it, referencing a CompactedArray array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless, on entry, CompactedArray_ConstIterator() != *this and *this - array.begin() < array.length().

◆ operator+=()

template<class TYPE >
CompactedArray_ConstIterator< TYPE > & bdlc::CompactedArray_ConstIterator< TYPE >::operator+= ( bsl::ptrdiff_t  offset)
inline

Advance this iterator by the specified offset from the location referenced by this iterator, and return a reference providing modifiable access to this iterator. The returned iterator, it, referencing a CompactedArray array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless CompactedArray_ConstIterator() != *this and 0 <= *this - array.begin() + offset <= array.length().

◆ operator--()

template<class TYPE >
CompactedArray_ConstIterator< TYPE > & bdlc::CompactedArray_ConstIterator< TYPE >::operator-- ( )
inline

Decrement this iterator to refer to the previous location in the referenced array, and return a reference to this iterator after the decrementation. The returned iterator, it, referencing a CompactedArray array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless, on entry, CompactedArray_ConstIterator() != *this and 0 < *this - array.begin().

◆ operator-=()

template<class TYPE >
CompactedArray_ConstIterator< TYPE > & bdlc::CompactedArray_ConstIterator< TYPE >::operator-= ( bsl::ptrdiff_t  offset)
inline

Decrement this iterator by the specified offset from the location referenced by this iterator, and return a reference providing modifiable access to this iterator. The returned iterator, it, referencing a CompactedArray array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless CompactedArray_ConstIterator() != *this and 0 <= *this - array.begin() - offset <= array.length().

◆ operator->()

template<class TYPE >
const TYPE & bdlc::CompactedArray_ConstIterator< TYPE >::operator-> ( ) const
inline

Return a const reference to the element referenced by this iterator. The behavior is undefined unless for this iterator, referencing a CompactedArray array, CompactedArray_ConstIterator() != *this and *this - array.begin() < array.length().

◆ operator=()

template<class TYPE >
CompactedArray_ConstIterator< TYPE > & bdlc::CompactedArray_ConstIterator< TYPE >::operator= ( const CompactedArray_ConstIterator< TYPE > &  rhs)
inline

Assign to this iterator the value of the specified rhs iterator, and return a reference providing modifiable access to this iterator.

◆ operator[]()

template<class TYPE >
const TYPE & bdlc::CompactedArray_ConstIterator< TYPE >::operator[] ( bsl::ptrdiff_t  offset) const
inline

Return a const reference to the element at the specified offset from the location referenced by this iterator. The behavior is undefined unless for this iterator, referencing a CompactedArray array, CompactedArray_ConstIterator() != *this and 0 <= *this - array.begin() + offset < array.length().

Friends And Related Symbol Documentation

◆ CompactedArray< TYPE >

template<class TYPE >
friend class CompactedArray< TYPE >
friend

◆ operator!=

template<class TYPE >
bool operator!= ( const CompactedArray_ConstIterator< TYPE > &  ,
const CompactedArray_ConstIterator< TYPE > &   
)
friend

Return true if the specified lhs and rhs iterators do not have the same value, and false otherwise. Two CompactedArray_ConstIterator iterators do not have the same value if one has the default value and the other does not, or neither has the default value and they do not reference the same location in the same array.

◆ operator+

template<class TYPE >
CompactedArray_ConstIterator< TYPE > operator+ ( const CompactedArray_ConstIterator< TYPE > &  ,
bsl::ptrdiff_t   
)
friend

Return an iterator referencing the location at the specified offset from the location referenced by the specified iterator. The returned iterator, it, referencing a CompactedArray array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless CompactedArray_ConstIterator() != iterator and 0 <= iterator - array.begin() + offset <= array.length().

◆ operator++

template<class TYPE >
CompactedArray_ConstIterator operator++ ( CompactedArray_ConstIterator< TYPE > &  ,
int   
)
friend

Advance the specified iterator to refer to the next location in the referenced array, and return an iterator referring to the original location (before the advancement). The returned iterator, it, referencing a CompactedArray array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless, on entry, CompactedArray_ConstIterator() != iterator and iterator - array.begin() < array.length().

◆ operator- [1/2]

template<class TYPE >
bsl::ptrdiff_t operator- ( const CompactedArray_ConstIterator< TYPE > &  ,
const CompactedArray_ConstIterator< TYPE > &   
)
friend

Return the number of elements between the specified lhs and rhs as a signed value. The behavior is undefined unless lhs and rhs reference the same array. Note that the return value is positive when a positive number of rhs++ invocations would result in lhs == rhs, and negative when a positive number of rhs-- invocations would result in lhs == rhs.

◆ operator- [2/2]

template<class TYPE >
CompactedArray_ConstIterator< TYPE > operator- ( const CompactedArray_ConstIterator< TYPE > &  ,
bsl::ptrdiff_t   
)
friend

Return an iterator referencing the location at the specified offset from the location referenced by the specified iterator. The returned iterator, it, referencing a CompactedArray array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless CompactedArray_ConstIterator() != iterator and 0 <= iterator - array.begin() - offset <= array.length().

◆ operator--

template<class TYPE >
CompactedArray_ConstIterator operator-- ( CompactedArray_ConstIterator< TYPE > &  ,
int   
)
friend

Decrement the specified iterator to refer to the previous location in the referenced array, and return an iterator referring to the original location (before the decrementation). The returned iterator, it, referencing a CompactedArray array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless, on entry, CompactedArray_ConstIterator() != iterator and 0 < iterator - array.begin().

◆ operator<

template<class TYPE >
bool operator< ( const CompactedArray_ConstIterator< TYPE > &  ,
const CompactedArray_ConstIterator< TYPE > &   
)
friend

Return true if the specified lhs has a value less than the specified rhs, and false otherwise. Iterator lhs has a value less than iterator rhs if 0 < rhs - lhs (see operator-). The behavior is undefined unless lhs and rhs refer to the same array.

◆ operator<=

template<class TYPE >
bool operator<= ( const CompactedArray_ConstIterator< TYPE > &  ,
const CompactedArray_ConstIterator< TYPE > &   
)
friend

Return true if the specified lhs has a value less than or equal to the specified rhs, andfalse' otherwise. Iterator lhs has a value less than or equal to iterator rhs if 0 <= rhs - lhs (see operator-). The behavior is undefined unless lhs and rhs refer to the same array.

◆ operator==

template<class TYPE >
bool operator== ( const CompactedArray_ConstIterator< TYPE > &  ,
const CompactedArray_ConstIterator< TYPE > &   
)
friend

Return true if the specified lhs and rhs iterators have the same value, and false otherwise. Two CompactedArray_ConstIterator iterators have the same value if they both have the default value, or neither has the default value and they reference the same location in the same array.

◆ operator>

template<class TYPE >
bool operator> ( const CompactedArray_ConstIterator< TYPE > &  ,
const CompactedArray_ConstIterator< TYPE > &   
)
friend

Return true if the specified lhs has a value greater than the specified rhs, and false otherwise. Iterator lhs has a value greater than iterator rhs if 0 > rhs - lhs (see operator-). The behavior is undefined unless lhs and rhs refer to the same array.

◆ operator>=

template<class TYPE >
bool operator>= ( const CompactedArray_ConstIterator< TYPE > &  ,
const CompactedArray_ConstIterator< TYPE > &   
)
friend

Return true if the specified lhs has a value greater or equal than the specified rhs, and false otherwise. Iterator lhs has a value greater than or equal to iterator rhs if 0 >= rhs - lhs (see operator-). The behavior is undefined unless lhs and rhs refer to the same array.


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