Quick Links:

bal | bbl | bdl | bsl

Public Member Functions | Friends

bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH > Class Template Reference

#include <bslalg_dequeiterator.h>

List of all members.

Public Member Functions

 DequeIterator ()
 DequeIterator (BlockPtr *blockPtrPtr)
 DequeIterator (BlockPtr *blockPtrPtr, VALUE_TYPE *valuePtr)
void operator++ ()
void operator-- ()
void operator+= (std::ptrdiff_t offset)
void operator-= (std::ptrdiff_t offset)
void nextBlock ()
void previousBlock ()
void setBlock (BlockPtr *blockPtrPtr)
void valuePtrDecrement ()
void valuePtrIncrement ()
VALUE_TYPE & operator* () const
DequeIterator operator+ (std::ptrdiff_t offset) const
DequeIterator operator- (std::ptrdiff_t offset) const
std::ptrdiff_t operator- (const DequeIterator &rhs) const
VALUE_TYPE * blockBegin () const
VALUE_TYPE * blockEnd () const
BlockPtrblockPtr () const
std::size_t offsetInBlock () const
std::size_t remainingInBlock () const
VALUE_TYPE * valuePtr () const

Friends

bool operator== (const DequeIterator &lhs, const DequeIterator &rhs)
bool operator!= (const DequeIterator &lhs, const DequeIterator &rhs)
bool operator< (const DequeIterator &lhs, const DequeIterator &rhs)

Detailed Description

template<class VALUE_TYPE, int BLOCK_LENGTH>
class bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >

Implementation of a deque iterator, parameterized by the VALUE_TYPE, for a deque with the parameterized BLOCK_LENGTH, and suitable for use by the bslstl::RandomAccessIterator adapter. Note that BLOCK_LENGTH is the number of items of VALUE_TYPE within a block, not the size of a block in bytes.

See Component bslalg_dequeiterator


Constructor & Destructor Documentation

template<class VALUE_TYPE , int BLOCK_LENGTH>
bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::DequeIterator (  ) 

Create a singular iterator (i.e., having internal null pointers).

template<class VALUE_TYPE , int BLOCK_LENGTH>
bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::DequeIterator ( BlockPtr blockPtrPtr  )  [explicit]

Create an iterator pointing to the first element in the block pointed to by the specified blockPtrPtr.

template<class VALUE_TYPE , int BLOCK_LENGTH>
bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::DequeIterator ( BlockPtr blockPtrPtr,
VALUE_TYPE *  valuePtr 
)

Create an iterator pointing to the element at the specified valuePtr address in the block pointed to by the specified blockPtrPtr. The behavior is undefined unless valuePtr points into the block *blockPtrPtr.


Member Function Documentation

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::operator++ (  ) 

Increment this iterator to point to the next element in the corresponding deque (i.e., the element following the current one in the same block or, if the current element is the last one in the block, the first element in the next block).

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::operator-- (  ) 

Decrement this iterator to point to the previous element in the corresponding deque (i.e., the element preceding the current one in the same block or, if the current element is the first one in the block, the last element in the previous block).

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::operator+= ( std::ptrdiff_t  offset  ) 

Advance this iterator by the specified offset.

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::operator-= ( std::ptrdiff_t  offset  ) 

Move this iterator backward by the specified offset.

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::nextBlock (  ) 

Set this iterator to point to the first element of the next block.

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::previousBlock (  ) 

Set this iterator to point to the first (not the last) element of the previous block.

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::setBlock ( BlockPtr blockPtrPtr  ) 

Set this iterator to point to the first element of the block pointed to by the specified blockPtrPtr.

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::valuePtrDecrement (  ) 

Decrement this iterator to point to the next element in the block of the corresponding deque. The behavior is undefined unless this iterator is pointed to a valid position of the deque. Note that this method is used only for optimization purposes in bslstl_Deque, and clients of this package should not use this directly.

template<class VALUE_TYPE , int BLOCK_LENGTH>
void bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::valuePtrIncrement (  ) 

Increment this iterator to point to the next element in the block of the corresponding deque. The behavior is undefined unless this iterator is pointed to a valid position of the deque. Note that this method is used only for optimization purposes in bslstl_Deque, and clients of this package should not use this directly.

template<class VALUE_TYPE , int BLOCK_LENGTH>
VALUE_TYPE& bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::operator* (  )  const

Return a reference to the parameterized VALUE_TYPE object pointed to by this iterator. Note that this value is modifiable if VALUE_TYPE is modifiable, and non-modifiable if it is not.

template<class VALUE_TYPE , int BLOCK_LENGTH>
DequeIterator bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::operator+ ( std::ptrdiff_t  offset  )  const

Return an iterator pointing the element at the specified offset after this iterator.

template<class VALUE_TYPE , int BLOCK_LENGTH>
DequeIterator bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::operator- ( std::ptrdiff_t  offset  )  const

Return an iterator pointing the element at the specified offset before this iterator.

template<class VALUE_TYPE , int BLOCK_LENGTH>
std::ptrdiff_t bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::operator- ( const DequeIterator< VALUE_TYPE, BLOCK_LENGTH > &  rhs  )  const

Return the distance between this iterator and the specified rhs iterator.

template<class VALUE_TYPE , int BLOCK_LENGTH>
VALUE_TYPE* bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::blockBegin (  )  const

Return the address of the first element in the block pointed to by this iterator.

template<class VALUE_TYPE , int BLOCK_LENGTH>
VALUE_TYPE* bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::blockEnd (  )  const

Return the address of (one-past) the last element in the block pointed to by this iterator.

template<class VALUE_TYPE , int BLOCK_LENGTH>
BlockPtr* bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::blockPtr (  )  const

Return the address of the block pointer pointed to by this iterator.

template<class VALUE_TYPE , int BLOCK_LENGTH>
std::size_t bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::offsetInBlock (  )  const

Return the offset of the element pointed to by this iterator, from the beginning of the block containing it.

template<class VALUE_TYPE , int BLOCK_LENGTH>
std::size_t bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::remainingInBlock (  )  const

Return the number of elements in the block pointed to by this iterator, until the end of this block, starting at (and including) the element pointed to by this iterator.

template<class VALUE_TYPE , int BLOCK_LENGTH>
VALUE_TYPE* bslalg::DequeIterator< VALUE_TYPE, BLOCK_LENGTH >::valuePtr (  )  const

Return the address of the parameterized VALUE_TYPE object pointed to by this iterator.


Friends And Related Function Documentation

template<class VALUE_TYPE , int BLOCK_LENGTH>
bool operator== ( const DequeIterator< VALUE_TYPE, BLOCK_LENGTH > &  lhs,
const DequeIterator< VALUE_TYPE, BLOCK_LENGTH > &  rhs 
) [friend]
Parameters:
rhs Return true if the specified lhs iterator points to the same element in the same block as the specified rhs iterator, and false otherwise. The behavior is undefined unless lhs and rhs are iterators over the same deque. Note that this friend is a regular functon, not a function template, so there is no way to declare it outside the class in order to provide the definition.
template<class VALUE_TYPE , int BLOCK_LENGTH>
bool operator!= ( const DequeIterator< VALUE_TYPE, BLOCK_LENGTH > &  lhs,
const DequeIterator< VALUE_TYPE, BLOCK_LENGTH > &  rhs 
) [friend]
Parameters:
rhs Return true if the specified lhs iterator points to a different element in the same block as the specified rhs iterator, or points to an element in a different block to the rhs iterator, and false otherwise. The behavior is undefined unless lhs and rhs are iterators over the same deque. Note that this friend is a regular functon, not a function template, so there is no way to declare it outside the class in order to provide the definition.
template<class VALUE_TYPE , int BLOCK_LENGTH>
bool operator< ( const DequeIterator< VALUE_TYPE, BLOCK_LENGTH > &  lhs,
const DequeIterator< VALUE_TYPE, BLOCK_LENGTH > &  rhs 
) [friend]
Parameters:
rhs Return true if the specified lhs iterator points to an element in a previous block or in a previous position in the same block as the specified rhs iterator, and false otherwise. The behavior is undefined unless lhs and rhs are iterators over the same deque. Note that this friend is a regular functon, not a function template, so there is no way to declare it outside the class in order to provide the definition.

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