|
BDE 4.39.x Production Release
|
#include <bslstl_deque.h>
This class template provides an STL-compliant deque that conforms to the bslma::Allocator model. For the requirements of a deque class, consult the C++11 standard. In particular, this implementation offers the general rules that:
bslstl::StdExceptUtil::throwLengthError.at method that attempts to access a position outside of the valid range of a deque triggers a call to bslstl::StdExceptUtil::throwOutOfRange.Deque_Base, which is parameterized on only VALUE_TYPE in order to generate smaller debug strings.This class:
BDEX serializationconst thread-safe For terminology see bsldoc_glossary .In addition, the following members offer a full guarantee of rollback: if an exception is thrown during the invocation of insert, push_front, or push_back on a pre-existing object, the object is left in a valid state and its value is unchanged.
Public Types | |
| typedef VALUE_TYPE & | reference |
| typedef const VALUE_TYPE & | const_reference |
| typedef Iterator | iterator |
| typedef ConstIterator | const_iterator |
| typedef std::size_t | size_type |
| typedef std::ptrdiff_t | difference_type |
| typedef VALUE_TYPE | value_type |
| typedef ALLOCATOR | allocator_type |
| typedef AllocatorTraits::pointer | pointer |
| typedef AllocatorTraits::const_pointer | const_pointer |
| typedef bsl::reverse_iterator< Iterator > | reverse_iterator |
| typedef bsl::reverse_iterator< ConstIterator > | const_reverse_iterator |
Public Types inherited from bsl::Deque_Base< VALUE_TYPE > | |
| typedef VALUE_TYPE & | reference |
| typedef const VALUE_TYPE & | const_reference |
| typedef Iterator | iterator |
| typedef ConstIterator | const_iterator |
| typedef std::size_t | size_type |
| typedef std::ptrdiff_t | difference_type |
| typedef VALUE_TYPE | value_type |
| typedef bsl::reverse_iterator< Iterator > | reverse_iterator |
| typedef bsl::reverse_iterator< ConstIterator > | const_reverse_iterator |
Public Member Functions | |
| deque () | |
| deque (const ALLOCATOR &basicAllocator) | |
| deque (size_type numElements, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
| deque (size_type numElements, const VALUE_TYPE &value, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
| template<class INPUT_ITERATOR > | |
| deque (INPUT_ITERATOR first, INPUT_ITERATOR last, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
| template<class t_RANGE > | |
| deque (from_range_t, BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range, const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
| deque (const deque &original) | |
| deque (const deque &original, const typename type_identity< ALLOCATOR >::type &basicAllocator) | |
| deque (BloombergLP::bslmf::MovableRef< deque > original) | |
| deque (BloombergLP::bslmf::MovableRef< deque > original, const typename type_identity< ALLOCATOR >::type &basicAllocator) | |
| ~deque () | |
| deque & | operator= (const deque &rhs) |
| template<class INPUT_ITERATOR > | |
| deque &operator=(BloombergLP::bslmf::MovableRef< deque > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void | assign (INPUT_ITERATOR first, INPUT_ITERATOR last) |
| void | assign (size_type numElements, const VALUE_TYPE &value) |
| template<class t_RANGE > | |
| void | assign_range (BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range) |
| void | reserve (size_type numElements) |
| void | resize (size_type newSize) |
| void | resize (size_type newSize, const VALUE_TYPE &value) |
| void | shrink_to_fit () |
| template<class t_RANGE > | |
| void | append_range (BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range) |
| template<class t_RANGE > | |
| void | prepend_range (BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range) |
| void | push_front (const VALUE_TYPE &value) |
| void | push_front (BloombergLP::bslmf::MovableRef< value_type > value) |
| void | push_back (const VALUE_TYPE &value) |
| void | push_back (BloombergLP::bslmf::MovableRef< value_type > value) |
| template<class... Args> | |
| reference | emplace_front (Args &&... arguments) |
| template<class... Args> | |
| reference | emplace_back (Args &&... arguments) |
| template<class... Args> | |
| iterator | emplace (const_iterator position, Args &&... arguments) |
| void | pop_front () |
| void | pop_back () |
| iterator | insert (const_iterator position, const VALUE_TYPE &value) |
| iterator | insert (const_iterator position, BloombergLP::bslmf::MovableRef< value_type > value) |
| iterator | insert (const_iterator position, size_type numElements, const VALUE_TYPE &value) |
| template<class INPUT_ITERATOR > | |
| iterator | insert (const_iterator position, INPUT_ITERATOR first, INPUT_ITERATOR last) |
| template<class t_RANGE > | |
| iterator | insert_range (const_iterator position, BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range) |
| iterator | erase (const_iterator position) |
| iterator | erase (const_iterator first, const_iterator last) |
| allocator_type | get_allocator () const BSLS_KEYWORD_NOEXCEPT |
| size_type | max_size () const BSLS_KEYWORD_NOEXCEPT |
| template<class INPUT_ITERATOR , class SENTINEL > | |
| deque< VALUE_TYPE, ALLOCATOR >::size_type | privateAppend (INPUT_ITERATOR first, SENTINEL last) |
| template<class INPUT_ITERATOR , class SENTINEL > | |
| deque< VALUE_TYPE, ALLOCATOR >::size_type | privateAppend (INPUT_ITERATOR first, SENTINEL last, std::random_access_iterator_tag) |
| template<class INPUT_ITERATOR , class SENTINEL > | |
| deque< VALUE_TYPE, ALLOCATOR >::size_type | privateAppend (INPUT_ITERATOR first, SENTINEL last, std::input_iterator_tag) |
| template<class INTEGRAL_TYPE > | |
| void | privateInsertDispatch (const_iterator position, INTEGRAL_TYPE numElements, INTEGRAL_TYPE value, BloombergLP::bslmf::MatchArithmeticType, BloombergLP::bslmf::Nil) |
| template<class INPUT_ITERATOR , class SENTINEL > | |
| deque< VALUE_TYPE, ALLOCATOR >::size_type | privatePrepend (INPUT_ITERATOR first, SENTINEL last) |
| template<class INPUT_ITERATOR , class SENTINEL > | |
| deque< VALUE_TYPE, ALLOCATOR >::size_type | privatePrepend (INPUT_ITERATOR first, SENTINEL last, std::input_iterator_tag tag) |
| template<class INPUT_ITERATOR , class SENTINEL > | |
| deque< VALUE_TYPE, ALLOCATOR >::size_type | privatePrepend (INPUT_ITERATOR first, SENTINEL last, std::bidirectional_iterator_tag) |
| template<class INPUT_ITERATOR , class SENTINEL > | |
| deque< VALUE_TYPE, ALLOCATOR >::size_type | privatePrepend (INPUT_ITERATOR first, SENTINEL last, std::random_access_iterator_tag) |
| template<class INPUT_ITERATOR > | |
| void | assign (INPUT_ITERATOR first, INPUT_ITERATOR last) |
| template<class... Args> | |
| deque< VALUE_TYPE, ALLOCATOR >::reference | emplace_front (Args &&...arguments) |
| template<class... Args> | |
| deque< VALUE_TYPE, ALLOCATOR >::reference | emplace_back (Args &&...arguments) |
| template<class... Args> | |
| deque< VALUE_TYPE, ALLOCATOR >::iterator | emplace (const_iterator position, Args &&... arguments) |
| template<class INPUT_ITERATOR > | |
| deque< VALUE_TYPE, ALLOCATOR >::iterator | insert (const_iterator position, INPUT_ITERATOR first, INPUT_ITERATOR last) |
| template<class t_RANGE > | |
| deque< VALUE_TYPE, ALLOCATOR >::iterator | insert_range (const_iterator position, BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range) |
Public Member Functions inherited from bsl::Deque_Base< VALUE_TYPE > | |
| iterator | begin () BSLS_KEYWORD_NOEXCEPT |
| iterator | end () BSLS_KEYWORD_NOEXCEPT |
| reverse_iterator | rbegin () BSLS_KEYWORD_NOEXCEPT |
| reverse_iterator | rend () BSLS_KEYWORD_NOEXCEPT |
| reference | operator[] (size_type position) |
| reference | at (size_type position) |
| reference | front () |
| reference | back () |
| const_iterator | begin () const BSLS_KEYWORD_NOEXCEPT |
| const_iterator | cbegin () const BSLS_KEYWORD_NOEXCEPT |
| const_iterator | end () const BSLS_KEYWORD_NOEXCEPT |
| const_iterator | cend () const BSLS_KEYWORD_NOEXCEPT |
| const_reverse_iterator | rbegin () const BSLS_KEYWORD_NOEXCEPT |
| const_reverse_iterator | crbegin () const BSLS_KEYWORD_NOEXCEPT |
| const_reverse_iterator | rend () const BSLS_KEYWORD_NOEXCEPT |
| const_reverse_iterator | crend () const BSLS_KEYWORD_NOEXCEPT |
| size_type | size () const BSLS_KEYWORD_NOEXCEPT |
| size_type | capacity () const BSLS_KEYWORD_NOEXCEPT |
| bool | empty () const BSLS_KEYWORD_NOEXCEPT |
| const_reference | operator[] (size_type position) const |
| const_reference | at (size_type position) const |
| const_reference | front () const |
| const_reference | back () const |
Public Attributes | |
| void swap(deque< VALUE_TYPE, ALLOCATOR > &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void | clear () BSLS_KEYWORD_NOEXCEPT |
Friends | |
| template<class VALUE_TYPE2 , class ALLOCATOR2 > | |
| class | Deque_BlockCreator |
| template<class VALUE_TYPE2 , class ALLOCATOR2 > | |
| class | Deque_BlockProctor |
| template<class VALUE_TYPE2 , class ALLOCATOR2 > | |
| class | Deque_Guard |
Additional Inherited Members | |
Protected Attributes inherited from bsl::Deque_Base< VALUE_TYPE > | |
| BlockPtr * | d_blocks_p |
| std::size_t | d_blocksLength |
| IteratorImp | d_start |
| IteratorImp | d_finish |
| typedef ALLOCATOR bsl::deque< VALUE_TYPE, ALLOCATOR >::allocator_type |
| typedef ConstIterator bsl::deque< VALUE_TYPE, ALLOCATOR >::const_iterator |
| typedef AllocatorTraits::const_pointer bsl::deque< VALUE_TYPE, ALLOCATOR >::const_pointer |
| typedef const VALUE_TYPE& bsl::deque< VALUE_TYPE, ALLOCATOR >::const_reference |
| typedef bsl::reverse_iterator<ConstIterator> bsl::deque< VALUE_TYPE, ALLOCATOR >::const_reverse_iterator |
| typedef std::ptrdiff_t bsl::deque< VALUE_TYPE, ALLOCATOR >::difference_type |
| typedef Iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::iterator |
| typedef AllocatorTraits::pointer bsl::deque< VALUE_TYPE, ALLOCATOR >::pointer |
| typedef VALUE_TYPE& bsl::deque< VALUE_TYPE, ALLOCATOR >::reference |
| typedef bsl::reverse_iterator<Iterator> bsl::deque< VALUE_TYPE, ALLOCATOR >::reverse_iterator |
| typedef std::size_t bsl::deque< VALUE_TYPE, ALLOCATOR >::size_type |
| typedef VALUE_TYPE bsl::deque< VALUE_TYPE, ALLOCATOR >::value_type |
| bsl::deque< VALUE_TYPE, ALLOCATOR >::deque | ( | ) |
Create an empty deque. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator, if supplied, shall be convertible to bslma::Allocator *. If the type ALLOCATOR is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used.
|
explicit |
|
explicit |
Create a deque of the specified numElements size whose every element is value-initialized. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator, if supplied, shall be convertible to bslma::Allocator *. If the type ALLOCATOR is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used. Throw bsl::length_error if numElements > max_size(). This method requires that the (template parameter) VALUE_TYPE be default-insertable into this deque (see {Requirements on VALUE_TYPE}).
| bsl::deque< VALUE_TYPE, ALLOCATOR >::deque | ( | size_type | numElements, |
| const VALUE_TYPE & | value, | ||
| const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
| ) |
Create a deque of the specified numElements size whose every element has the specified value. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator, if supplied, shall be convertible to bslma::Allocator *. If the type ALLOCATOR is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used. Throw bsl::length_error if numElements > max_size(). This method requires that the (template parameter) VALUE_TYPE be copy-insertable into this deque (see {Requirements on VALUE_TYPE}).
| bsl::deque< VALUE_TYPE, ALLOCATOR >::deque | ( | INPUT_ITERATOR | first, |
| INPUT_ITERATOR | last, | ||
| const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
| ) |
Create a deque initially containing copies of the values in the range starting at the specified first and ending immediately before the specified last iterators of the (template parameter) type INPUT_ITERATOR. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator, if supplied, shall be convertible to bslma::Allocator *. If the type ALLOCATOR is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used. Throw bsl::length_error if the number of elements in [first .. last) exceeds the size returned by max_size . The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [input.iterators] providing access to values of a type convertible to value_type, and value_type must be emplace-constructible from *i into this deque, where i is a dereferenceable iterator in the range [first .. last) (see {Requirements on VALUE_TYPE}).
first and last refer to a sequence of valid values where first is at a position at or before last. | bsl::deque< VALUE_TYPE, ALLOCATOR >::deque | ( | from_range_t | , |
| BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) | range, | ||
| const ALLOCATOR & | basicAllocator = ALLOCATOR() |
||
| ) |
Create a deque from the elements of the specifed range. Optionally specify an basicAllocator used to supply memory. If basicAllocator is not specified, a default-constructed object of the (template parameter) type ALLOCATOR is used.
range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE_TYPE. | bsl::deque< VALUE_TYPE, ALLOCATOR >::deque | ( | const deque< VALUE_TYPE, ALLOCATOR > & | original | ) |
Create a deque that has the same value as the specified original object. Use the allocator returned by 'bsl::allocator_traits<ALLOCATOR>:: select_on_container_copy_construction(original.get_allocator())' to supply memory. If the (template parameter) type ALLOCATOR is bsl::allocator (the default), the currently installed default allocator is used. This method requires that the (template parameter) VALUE_TYPE be copy-insertable into this deque (see {Requirements on VALUE_TYPE}).
| bsl::deque< VALUE_TYPE, ALLOCATOR >::deque | ( | const deque< VALUE_TYPE, ALLOCATOR > & | original, |
| const typename type_identity< ALLOCATOR >::type & | basicAllocator | ||
| ) |
Create a deque that has the same value as the specified original object and that uses the specified basicAllocator to supply memory. This method requires that the (template parameter) VALUE_TYPE be copy-insertable into this deque (see {Requirements on VALUE_TYPE}).
bslma::Allocator * can be supplied for basicAllocator if the (template parameter) type ALLOCATOR is bsl::allocator (the default). | bsl::deque< VALUE_TYPE, ALLOCATOR >::deque | ( | BloombergLP::bslmf::MovableRef< deque< VALUE_TYPE, ALLOCATOR > > | original | ) |
Create a deque having the same value as the specified original object by moving (in constant time) the contents of original to the new deque. The allocator associated with original is propagated for use in the newly-created deque. original is left in a valid but unspecified state.
| bsl::deque< VALUE_TYPE, ALLOCATOR >::deque | ( | BloombergLP::bslmf::MovableRef< deque< VALUE_TYPE, ALLOCATOR > > | original, |
| const typename type_identity< ALLOCATOR >::type & | basicAllocator | ||
| ) |
Create a deque having the same value as the specified original object that uses the specified basicAllocator to supply memory. The contents of original are moved (in constant time) to the new deque if basicAllocator == original.get_allocator(), and are move- inserted (in linear time) using basicAllocator otherwise. original is left in a valid but unspecified state. This method requires that the (template parameter) VALUE_TYPE be move-insertable into this deque (see {Requirements on VALUE_TYPE}).
bslma::Allocator * can be supplied for basicAllocator if the (template parameter) ALLOCATOR is bsl::allocator (the default). | bsl::deque< VALUE_TYPE, ALLOCATOR >::~deque | ( | ) |
Destroy this object.
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::append_range | ( | BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) | range | ) |
Append to the end of this object the elements of the specified range.
range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE_TYPE. | deque &operator=(BloombergLP::bslmf::MovableRef< deque > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void bsl::deque< VALUE_TYPE, ALLOCATOR >::assign | ( | INPUT_ITERATOR | first, |
| INPUT_ITERATOR | last | ||
| ) |
Assign to this object the value of the specified rhs object, propagate to this object the allocator of rhs if the ALLOCATOR type has trait propagate_on_container_move_assignment , and return a reference providing modifiable access to this object. The contents of rhs are moved (in constant time) to this deque if get_allocator() == rhs.get_allocator() (after accounting for the aforementioned trait); otherwise, all elements in this deque are either destroyed or move-assigned to and each additional element in rhs is move-inserted into this deque. rhs is left in a valid but unspecified state, and if an exception is thrown, *this is left in a valid but unspecified state. This method requires that the (template parameter) VALUE_TYPE be move-assignable and move-insertable into this deque (see {Requirements on VALUE_TYPE}). Assign to this deque the values in the range starting at the specified first and ending immediately before the specified last iterators of the (template parameter) type INPUT_ITERATOR. The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [input.iterators] providing access to values of a type convertible to value_type, and value_type must be copy-assignable and emplace-constructible from *i into this deque, where i is a dereferenceable iterator in the range [first .. last) (see {Requirements on VALUE_TYPE}).
first and last refer to a sequence of valid values where first is at a position at or before last. | void bsl::deque< VALUE_TYPE, ALLOCATOR >::assign | ( | INPUT_ITERATOR | first, |
| INPUT_ITERATOR | last | ||
| ) |
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::assign | ( | size_type | numElements, |
| const VALUE_TYPE & | value | ||
| ) |
Assign to this object the value resulting from first clearing this deque and then appending the specified numElements having the specified value. This method requires that the (template parameter) VALUE_TYPE be copy-assignable and copy-insertable into this deque (see {Requirements on VALUE_TYPE}).
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::assign_range | ( | BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) | range | ) |
Assign to this object the elements of the specified range.
range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE_TYPE. | iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace | ( | const_iterator | position, |
| Args &&... | arguments | ||
| ) |
Insert at the specified position in this deque a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type, and return an iterator providing modifiable access to the newly created and inserted element. If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of value_type), this method has no effect. This method requires that the (template parameter) VALUE_TYPE be move-insertable into this deque and emplace-constructible from arguments (see {Requirements on VALUE_TYPE}).
position is an iterator in the range [cbegin() .. cend()] (both endpoints included). | deque< VALUE_TYPE, ALLOCATOR >::iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace | ( | const_iterator | position, |
| Args &&... | arguments | ||
| ) |
| reference bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace_back | ( | Args &&... | arguments | ) |
Append to the back of this deque a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type. Return a reference providing modifiable access to the inserted element. If an exception is thrown (other than by the move constructor of a non-copy-insertable value_type), this method has no effect. This method requires that the (template parameter) VALUE_TYPE be move-insertable into this deque and emplace-constructible from arguments (see {Requirements on VALUE_TYPE}).
| deque< VALUE_TYPE, ALLOCATOR >::reference bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace_back | ( | Args &&... | arguments | ) |
| reference bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace_front | ( | Args &&... | arguments | ) |
Prepend to the front of this deque a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type. Return a reference providing modifiable access to the inserted element. If an exception is thrown (other than by the move constructor of a non-copy-insertable value_type), this method has no effect. This method requires that the (template parameter) VALUE_TYPE be move-insertable into this deque and emplace-constructible from arguments (see {Requirements on VALUE_TYPE}).
| deque< VALUE_TYPE, ALLOCATOR >::reference bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace_front | ( | Args &&... | arguments | ) |
| deque< VALUE_TYPE, ALLOCATOR >::iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::erase | ( | const_iterator | first, |
| const_iterator | last | ||
| ) |
Remove from this deque the sequence of elements starting at the specified first position and ending before the specified last position, and return an iterator providing modifiable access to the element immediately following the last removed element, or the position returned by the method end if the removed elements were last in the sequence.
first is an iterator in the range [cbegin() .. cend()] (both endpoints included) and last is an iterator in the range [first .. cend()] (both endpoints included). | deque< VALUE_TYPE, ALLOCATOR >::iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::erase | ( | const_iterator | position | ) |
Remove from this deque the element at the specified position, and return an iterator providing modifiable access to the element immediately following the removed element, or the position returned by the method end if the removed element was the last in the sequence.
position is an iterator in the range [cbegin() .. cend()).
|
inline |
Return the allocator used by this deque to supply memory.
| deque< VALUE_TYPE, ALLOCATOR >::iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert | ( | const_iterator | position, |
| BloombergLP::bslmf::MovableRef< value_type > | value | ||
| ) |
Insert at the specified position in this deque the specified move-insertable value, and return an iterator providing modifiable access to the newly inserted element. value is left in a valid but unspecified state. If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of value_type), this method has no effect. This method requires that the (template parameter) VALUE_TYPE be move-insertable into this deque (see {Requirements on VALUE_TYPE}).
position is an iterator in the range [cbegin() .. cend()] (both endpoints included). | deque< VALUE_TYPE, ALLOCATOR >::iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert | ( | const_iterator | position, |
| const VALUE_TYPE & | value | ||
| ) |
Insert at the specified position in this deque a copy of the specified value, and return an iterator providing modifiable access to the newly inserted element. This method offers full guarantee of rollback in case an exception is thrown other than by the VALUE_TYPE copy constructor or assignment operator. This method requires that the (template parameter) VALUE_TYPE be copy-insertable into this deque (see {Requirements on VALUE_TYPE}).
position is an iterator in the range [cbegin() .. cend()] (both endpoints included). | iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert | ( | const_iterator | position, |
| INPUT_ITERATOR | first, | ||
| INPUT_ITERATOR | last | ||
| ) |
Insert at the specified position in this deque the values in the range starting at the specified first and ending immediately before the specified last iterators of the (template parameter) type INPUT_ITERATOR, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements. This method offers full guarantee of rollback in case an exception is thrown other than by the VALUE_TYPE copy constructor or assignment operator. The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [input.iterators] providing access to values of a type convertible to value_type, and value_type must be emplace-constructible from *i into this deque, where i is a dereferenceable iterator in the range [first .. last) (see {Requirements on VALUE_TYPE}).
position is an iterator in the range [cbegin() .. cend()] (both endpoints included), and first and last refer to a sequence of valid values where first is at a position at or before last.
|
inline |
| deque< VALUE_TYPE, ALLOCATOR >::iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert | ( | const_iterator | position, |
| size_type | numElements, | ||
| const VALUE_TYPE & | value | ||
| ) |
Insert at the specified position in this deque the specified numElements copies of the specified value, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements. This method offers full guarantee of rollback in case an exception is thrown other than by the VALUE_TYPE copy constructor or assignment operator. This method requires that the (template parameter) VALUE_TYPE be copy-insertable into this deque (see {Requirements on VALUE_TYPE}).
position is an iterator in the range [cbegin() .. cend()] (both endpoints included). | iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert_range | ( | const_iterator | position, |
| BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) | range | ||
| ) |
Insert at the specified position in this object the elements of the specified range.
range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE_TYPE. | deque< VALUE_TYPE, ALLOCATOR >::iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert_range | ( | const_iterator | position, |
| BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) | range | ||
| ) |
|
inline |
Return the maximum possible size of this deque.
size_type). Also note that any request to create or enlarge a deque to a size greater than max_size() is guaranteed to raise a bsl::length_error exception. | deque< VALUE_TYPE, ALLOCATOR > & bsl::deque< VALUE_TYPE, ALLOCATOR >::operator= | ( | const deque< VALUE_TYPE, ALLOCATOR > & | rhs | ) |
Assign to this object the value of the specified rhs object, propagate to this object the allocator of rhs if the ALLOCATOR type has trait propagate_on_container_copy_assignment , and return a reference providing modifiable access to this object. If an exception is thrown, *this is left in a valid but unspecified state. This method requires that the (template parameter) VALUE_TYPE be copy-assignable and copy-insertable into this deque (see {Requirements on VALUE_TYPE}).
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::pop_back | ( | ) |
Erase the last element from this deque.
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::pop_front | ( | ) |
Erase the first element from this deque.
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::prepend_range | ( | BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) | range | ) |
Prepend to the front of this object the elements of the specified range.
range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE_TYPE.
|
inline |
| deque< VALUE_TYPE, ALLOCATOR >::size_type bsl::deque< VALUE_TYPE, ALLOCATOR >::privateAppend | ( | INPUT_ITERATOR | first, |
| SENTINEL | last, | ||
| std::input_iterator_tag | |||
| ) |
| deque< VALUE_TYPE, ALLOCATOR >::size_type bsl::deque< VALUE_TYPE, ALLOCATOR >::privateAppend | ( | INPUT_ITERATOR | first, |
| SENTINEL | last, | ||
| std::random_access_iterator_tag | |||
| ) |
|
inline |
|
inline |
| deque< VALUE_TYPE, ALLOCATOR >::size_type bsl::deque< VALUE_TYPE, ALLOCATOR >::privatePrepend | ( | INPUT_ITERATOR | first, |
| SENTINEL | last, | ||
| std::bidirectional_iterator_tag | |||
| ) |
| deque< VALUE_TYPE, ALLOCATOR >::size_type bsl::deque< VALUE_TYPE, ALLOCATOR >::privatePrepend | ( | INPUT_ITERATOR | first, |
| SENTINEL | last, | ||
| std::input_iterator_tag | tag | ||
| ) |
| deque< VALUE_TYPE, ALLOCATOR >::size_type bsl::deque< VALUE_TYPE, ALLOCATOR >::privatePrepend | ( | INPUT_ITERATOR | first, |
| SENTINEL | last, | ||
| std::random_access_iterator_tag | |||
| ) |
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::push_back | ( | BloombergLP::bslmf::MovableRef< value_type > | value | ) |
Append to the back of this deque the specified move-insertable value. value is left in a valid but unspecified state. If an exception is thrown (other than by the move constructor of a non-copy-insertable value_type), this method has no effect. This method requires that the (template parameter) VALUE_TYPE be move-insertable into this deque (see {Requirements on VALUE_TYPE}).
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::push_back | ( | const VALUE_TYPE & | value | ) |
Append to the back of this deque a copy of the specified value. This method offers full guarantee of rollback in case an exception is thrown. This method requires that the (template parameter) VALUE_TYPE be copy-constructible (see {Requirements on VALUE_TYPE}).
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::push_front | ( | BloombergLP::bslmf::MovableRef< value_type > | value | ) |
Prepend to the front of this deque the specified move-insertable value. value is left in a valid but unspecified state. If an exception is thrown (other than by the move constructor of a non-copy-insertable value_type), this method has no effect. This method requires that the (template parameter) VALUE_TYPE be move-insertable into this deque (see {Requirements on VALUE_TYPE}).
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::push_front | ( | const VALUE_TYPE & | value | ) |
Prepend to the front of this deque a copy of the specified value. This method offers full guarantee of rollback in case an exception is thrown. This method requires that the (template parameter) VALUE_TYPE be copy-constructible (see {Requirements on VALUE_TYPE}).
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::reserve | ( | size_type | numElements | ) |
Change the capacity of this deque such that, after this method returns, iterators remain valid provided that no more than the specified numElements objects are pushed to the front or back of the deque after this call. If it is already possible to push numElements objects to either end of this deque without invalidating iterators, this method has no effect.
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::resize | ( | size_type | newSize | ) |
Change the size of this deque to the specified newSize. Erase size() - newSize elements at the back if newSize < size(). Append newSize - size() elements at the back having the optionally specified value if newSize > size(); if value is not specified, value-initialized objects of the (template parameter) VALUE_TYPE are emplaced. This method has no effect if newSize == size(). Throw bsl::length_error if newSize > max_size().
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::resize | ( | size_type | newSize, |
| const VALUE_TYPE & | value | ||
| ) |
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::shrink_to_fit | ( | ) |
Minimize the memory used by this deque to the extent possible without moving any contained elements. If an exception is thrown, the value of this object is unchanged.
VALUE_TYPE.
|
friend |
|
friend |
|
friend |
| void bsl::deque< VALUE_TYPE, ALLOCATOR >::clear |
Exchange the value of this object with that of the specified other object; also exchange the allocator of this object with that of other if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This method provides the no-throw exception-safety guarantee. This operation has O[1] complexity if either this object was created with the same allocator as other or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in this object and other, respectively.
s support for swapping objects created with different allocators whenALLOCATOR` does not have the propagate_on_container_swap trait is a departure from the C++ Standard. Remove all elements from this deque making its size 0.