This class allocates blocks at the front or back of a deque and tentatively adds them to the deque. It also keeps track of how many of the newly allocated blocks have actually been used by the deque. The destructor automatically frees any unused blocks (e.g., in case an exception is thrown).

Synopsis

Declared in <bslstl_deque.h>

template<
    class VALUE_TYPE,
    class ALLOCATOR>
class Deque_BlockCreator;

Member Functions

Name

Description

Deque_BlockCreator [constructor]

Construct a block allocator for the specified deque.

~Deque_BlockCreator [destructor]

Free any blocks that have been allocated by this allocator but have not yet been used by the deque.

insertAtBack

Allocate the specified n blocks at the back of the block array. This method invalidates all iterators except d_deque_p‐>d_start and d_deque_p‐>d_finish.

insertAtFront

Allocate the specified n blocks at the front of the block array. This method invalidates all iterators except d_deque_p‐>d_start and d_deque_p‐>d_finish.

release

Relinquish control over any allocated blocks. The destructor will do nothing following a call to this method.

reserveBlockSlots

Make room for the specified numNewBlocks pointers in the blocks array. If the specified atFront is true, then make room at the front of the array, else make room at the back of the array. Return a pointer to the insertion point, i.e., the point where new blocks can be stored into the array, working backwards if atFront is true, or working forwards if atFront is false. This method invalidates all iterators and updates d_deque_p‐>d_start and d_deque_p‐>d_finish.

Created with MrDocs