BloombergLP::bslalg::DequeIterator

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.

Synopsis

Declared in <bslalg_dequeiterator.h>

template<
    class VALUE_TYPE,
    int BLOCK_LENGTH>
class DequeIterator;

Member Functions

NameDescription
DequeIterator [constructor]Constructors
blockBegin Return the address of the first element in the block pointed to by this iterator.
blockEnd Return the address of (one-past) the last element in the block pointed to by this iterator.
blockPtr Return the address of the block pointer pointed to by this iterator.
nextBlock Set this iterator to point to the first element of the next block.
offsetInBlock Return the offset of the element pointed to by this iterator, from the beginning of the block containing it.
operator* 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.
operator+ Return an iterator pointing the element at the specified offset after this iterator.
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).
operator+= Advance this iterator by the specified offset.
operator- Subtraction operators
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).
operator-= Move this iterator backward by the specified offset.
previousBlock Set this iterator to point to the first (not the last) element of the previous block.
remainingInBlock 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.
setBlock Set this iterator to point to the first element of the block pointed to by the specified blockPtrPtr.
valuePtr Return the address of the parameterized VALUE_TYPE object pointed to by this iterator.
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.
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.

Specializations

NameDescription
DequeIterator<VALUE_TYPE, 1> This partial specialization of DequeIterator for the case when there is a single element per block uses simpler storage and a simpler implementation. The contract for all functions is the same, and so not repeated.

Friends

NameDescription
BloombergLP::bslalg::operator<=>Perform a three-way comparison between the specified lhs and rhs iterators. The behavior is undefined unless lhs and rhs are iterators over the same deque.
BloombergLP::bslalg::operator==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.