Quick Links:

bal | bbl | bdl | bsl

Classes | Typedefs | Enumerator | Functions | Variables | Friends

Component bslstl_deque
[Package bslstl]

Provide an STL-compliant deque class. More...

Classes

struct  bsl::Deque_BlockLengthCalcUtil< VALUE_TYPE >
struct  bsl::Deque_Util
class  bsl::Deque_Base< VALUE_TYPE >
class  bsl::deque< VALUE_TYPE, ALLOCATOR >
class  bsl::Deque_BlockCreator< VALUE_TYPE, ALLOCATOR >
class  bsl::Deque_BlockProctor< VALUE_TYPE, ALLOCATOR >
class  bsl::Deque_ClearGuard< VALUE_TYPE, ALLOCATOR >
class  bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >

Typedefs

typedef VALUE_TYPE & bsl::Deque_Base::reference
typedef const VALUE_TYPE & bsl::Deque_Base::const_reference
typedef Iterator bsl::Deque_Base::iterator
typedef ConstIterator bsl::Deque_Base::const_iterator
typedef std::size_t bsl::Deque_Base::size_type
typedef std::ptrdiff_t bsl::Deque_Base::difference_type
typedef VALUE_TYPE bsl::Deque_Base::value_type
typedef bsl::reverse_iterator
< Iterator > 
bsl::Deque_Base::reverse_iterator
typedef bsl::reverse_iterator
< ConstIterator > 
bsl::Deque_Base::const_reverse_iterator
typedef VALUE_TYPE & bsl::deque::reference
typedef const VALUE_TYPE & bsl::deque::const_reference
typedef Iterator bsl::deque::iterator
typedef ConstIterator bsl::deque::const_iterator
typedef std::size_t bsl::deque::size_type
typedef std::ptrdiff_t bsl::deque::difference_type
typedef VALUE_TYPE bsl::deque::value_type
typedef ALLOCATOR bsl::deque::allocator_type
typedef AllocatorTraits::pointer bsl::deque::pointer
typedef
AllocatorTraits::const_pointer 
bsl::deque::const_pointer
typedef bsl::reverse_iterator
< Iterator > 
bsl::deque::reverse_iterator
typedef bsl::reverse_iterator
< ConstIterator > 
bsl::deque::const_reverse_iterator

Functions

static void bsl::Deque_Util::swap (void *a, void *b)
iterator bsl::Deque_Base::begin () BSLS_KEYWORD_NOEXCEPT
iterator bsl::Deque_Base::end () BSLS_KEYWORD_NOEXCEPT
reverse_iterator bsl::Deque_Base::rbegin () BSLS_KEYWORD_NOEXCEPT
reverse_iterator bsl::Deque_Base::rend () BSLS_KEYWORD_NOEXCEPT
reference bsl::Deque_Base::operator[] (size_type position)
reference bsl::Deque_Base::at (size_type position)
reference bsl::Deque_Base::front ()
reference bsl::Deque_Base::back ()
const_iterator bsl::Deque_Base::begin () const BSLS_KEYWORD_NOEXCEPT
const_iterator bsl::Deque_Base::cbegin () const BSLS_KEYWORD_NOEXCEPT
const_iterator bsl::Deque_Base::end () const BSLS_KEYWORD_NOEXCEPT
const_iterator bsl::Deque_Base::cend () const BSLS_KEYWORD_NOEXCEPT
const_reverse_iterator bsl::Deque_Base::rbegin () const BSLS_KEYWORD_NOEXCEPT
const_reverse_iterator bsl::Deque_Base::crbegin () const BSLS_KEYWORD_NOEXCEPT
const_reverse_iterator bsl::Deque_Base::rend () const BSLS_KEYWORD_NOEXCEPT
const_reverse_iterator bsl::Deque_Base::crend () const BSLS_KEYWORD_NOEXCEPT
size_type bsl::Deque_Base::size () const BSLS_KEYWORD_NOEXCEPT
size_type bsl::Deque_Base::capacity () const BSLS_KEYWORD_NOEXCEPT
bool bsl::Deque_Base::empty () const BSLS_KEYWORD_NOEXCEPT
const_reference bsl::Deque_Base::operator[] (size_type position) const
const_reference bsl::Deque_Base::at (size_type position) const
const_reference bsl::Deque_Base::front () const
const_reference bsl::Deque_Base::back () const
 bsl::deque::deque ()
 bsl::deque::deque (const ALLOCATOR &basicAllocator)
 bsl::deque::deque (size_type numElements, const ALLOCATOR &basicAllocator=ALLOCATOR())
 bsl::deque::deque (size_type numElements, const VALUE_TYPE &value, const ALLOCATOR &basicAllocator=ALLOCATOR())
template<class INPUT_ITERATOR >
 bsl::deque::deque (INPUT_ITERATOR first, INPUT_ITERATOR last, const ALLOCATOR &basicAllocator=ALLOCATOR())
 bsl::deque::deque (const deque &original)
 bsl::deque::deque (const deque &original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
 bsl::deque::deque (BloombergLP::bslmf::MovableRef< deque > original)
 bsl::deque::deque (BloombergLP::bslmf::MovableRef< deque > original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
 bsl::deque::deque (std::initializer_list< value_type > values, const ALLOCATOR &basicAllocator=ALLOCATOR())
 bsl::deque::~deque ()
deque & bsl::deque::operator= (const deque &rhs)
deque &operator=(BloombergLP::bslmf::MovableRef
< deque > rhs)
BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits
deque & 
bsl::deque::operator= (std::initializer_list< value_type > values)
template<class INPUT_ITERATOR >
void bsl::deque::assign (INPUT_ITERATOR first, INPUT_ITERATOR last)
void bsl::deque::assign (size_type numElements, const VALUE_TYPE &value)
void bsl::deque::assign (std::initializer_list< value_type > values)
void bsl::deque::reserve (size_type numElements)
void bsl::deque::resize (size_type newSize)
void bsl::deque::resize (size_type newSize, const VALUE_TYPE &value)
void bsl::deque::shrink_to_fit ()
void bsl::deque::push_front (const VALUE_TYPE &value)
void bsl::deque::push_front (BloombergLP::bslmf::MovableRef< value_type > value)
void bsl::deque::push_back (const VALUE_TYPE &value)
void bsl::deque::push_back (BloombergLP::bslmf::MovableRef< value_type > value)
template<class... Args>
reference bsl::deque::emplace_front (Args &&...arguments)
template<class... Args>
reference bsl::deque::emplace_back (Args &&...arguments)
template<class... Args>
iterator bsl::deque::emplace (const_iterator position, Args &&...arguments)
void bsl::deque::pop_front ()
void bsl::deque::pop_back ()
iterator bsl::deque::insert (const_iterator position, const VALUE_TYPE &value)
iterator bsl::deque::insert (const_iterator position, BloombergLP::bslmf::MovableRef< value_type > value)
iterator bsl::deque::insert (const_iterator position, size_type numElements, const VALUE_TYPE &value)
template<class INPUT_ITERATOR >
iterator bsl::deque::insert (const_iterator position, INPUT_ITERATOR first, INPUT_ITERATOR last)
iterator bsl::deque::insert (const_iterator position, std::initializer_list< value_type > values)
iterator bsl::deque::erase (const_iterator position)
iterator bsl::deque::erase (const_iterator first, const_iterator last)
allocator_type bsl::deque::get_allocator () const BSLS_KEYWORD_NOEXCEPT
size_type bsl::deque::max_size () const BSLS_KEYWORD_NOEXCEPT
template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator== (const deque< VALUE_TYPE, ALLOCATOR > &lhs, const deque< VALUE_TYPE, ALLOCATOR > &rhs)
template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator!= (const deque< VALUE_TYPE, ALLOCATOR > &lhs, const deque< VALUE_TYPE, ALLOCATOR > &rhs)
template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator< (const deque< VALUE_TYPE, ALLOCATOR > &lhs, const deque< VALUE_TYPE, ALLOCATOR > &rhs)
template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator> (const deque< VALUE_TYPE, ALLOCATOR > &lhs, const deque< VALUE_TYPE, ALLOCATOR > &rhs)
template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator<= (const deque< VALUE_TYPE, ALLOCATOR > &lhs, const deque< VALUE_TYPE, ALLOCATOR > &rhs)
template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator>= (const deque< VALUE_TYPE, ALLOCATOR > &lhs, const deque< VALUE_TYPE, ALLOCATOR > &rhs)
template<class VALUE_TYPE , class ALLOCATOR , class BDE_OTHER_TYPE >
deque< VALUE_TYPE, ALLOCATOR >
::size_type 
bsl::erase (deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
template<class VALUE_TYPE , class ALLOCATOR , class PREDICATE >
deque< VALUE_TYPE, ALLOCATOR >
::size_type 
bsl::erase_if (deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
template<class VALUE_TYPE , class ALLOCATOR >
void bsl::swap (deque< VALUE_TYPE, ALLOCATOR > &a, deque< VALUE_TYPE, ALLOCATOR > &b) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b)))
 bsl::Deque_BlockCreator::Deque_BlockCreator (deque< VALUE_TYPE, ALLOCATOR > *deque)
 bsl::Deque_BlockCreator::~Deque_BlockCreator ()
void bsl::Deque_BlockCreator::insertAtFront (size_type n)
void bsl::Deque_BlockCreator::insertAtBack (size_type n)
BlockPtr * bsl::Deque_BlockCreator::reserveBlockSlots (size_type numNewBlocks, bool atFront)
void bsl::Deque_BlockCreator::release ()
 bsl::Deque_BlockProctor::Deque_BlockProctor (deque< VALUE_TYPE, ALLOCATOR > *deque, bool atFront)
 bsl::Deque_BlockProctor::~Deque_BlockProctor ()
void bsl::Deque_BlockProctor::release ()
 bsl::Deque_ClearGuard::Deque_ClearGuard (deque< VALUE_TYPE, ALLOCATOR > *deque)
 bsl::Deque_ClearGuard::~Deque_ClearGuard ()
void bsl::Deque_ClearGuard::release ()
 bsl::Deque_Guard::Deque_Guard (deque< VALUE_TYPE, ALLOCATOR > *deque, bool isTail)
 bsl::Deque_Guard::~Deque_Guard ()
std::size_t bsl::Deque_Guard::operator++ ()
std::size_t bsl::Deque_Guard::operator-- ()
void bsl::Deque_Guard::release ()
std::size_t bsl::Deque_Guard::count () const BSLS_KEYWORD_NOEXCEPT
IteratorImp bsl::Deque_Guard::begin () const BSLS_KEYWORD_NOEXCEPT
IteratorImp bsl::Deque_Guard::end () const BSLS_KEYWORD_NOEXCEPT

Variables

BlockPtr * bsl::Deque_Base::d_blocks_p
std::size_t bsl::Deque_Base::d_blocksLength
IteratorImp bsl::Deque_Base::d_start
IteratorImp bsl::Deque_Base::d_finish
void swap(deque< VALUE_TYPE,
ALLOCATOR > &other)
BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits
void 
bsl::deque::clear () BSLS_KEYWORD_NOEXCEPT

Friends

class bsl::deque::Deque_BlockCreator
class bsl::deque::Deque_BlockProctor
class bsl::deque::Deque_Guard

Detailed Description

Outline
Purpose:
Provide an STL-compliant deque class.
Classes:
bsl::deque STL-compliant deque template
Canonical Header:
bsl_deque.h
See also:
Component bslstl_vector
Description:
This component defines a single class template, bsl::deque, implementing the standard sequential container, std::deque, holding a dynamic sequence of values of a template parameter type.
An instantiation of deque is an allocator-aware, value-semantic type whose salient attributes are its size (number of contained elements) and the (ordered) sequence of values the deque contains. If deque is instantiated with a value type that is not value-semantic, then the deque will not retain all of its value-semantic qualities. In particular, if a value type cannot be tested for equality, then a deque containing elements of that type cannot be tested for equality. It is even possible to instantiate deque with a value type that does not have a copy-constructor, in which case the deque will not be copyable.
A deque meets the requirements of a sequential container with random access iterators in section [deque] of the C++ standard. The deque implemented here adheres to the C++11 standard when compiled with a C++11 compiler, and makes the best approximation when compiled with a C++03 compiler. In particular, for C++03 we emulate move semantics, but limit forwarding (in emplace) to const lvalues, and make no effort to emulate noexcept or initializer-lists.
Requirements on VALUE_TYPE:
A deque is a fully Value-Semantic Type (see bsldoc_glossary) only if the supplied VALUE_TYPE template parameter is fully value-semantic. It is possible to instantiate a deque with a VALUE_TYPE parameter that does not have a full set of value-semantic operations, but then some methods of the container may not be instantiable. The following terminology, adopted from the C++11 standard, is used in the function documentation of deque to describe a function's requirements for the VALUE_TYPE template parameter. These terms are also defined in section [17.6.3.1] of the C++11 standard. Note that, in the context of a deque instantiation, the requirements apply specifically to the deque's entry type, value_type, which is an alias for VALUE_TYPE.
Glossary:
  Legend
  ------
  'X'    - denotes an allocator-aware container type (e.g., 'deque')
  'T'    - 'value_type' associated with 'X'
  'A'    - type of the allocator used by 'X'
  'm'    - lvalue of type 'A' (allocator)
  'p',   - address ('T *') of uninitialized storage for a 'T' within an 'X'
  'rv'   - rvalue of type (non-'const') 'T'
  'v'    - rvalue or lvalue of type (possibly 'const') 'T'
  'args' - 0 or more arguments
The following terms are used to more precisely specify the requirements on template parameter types in function-level documentation.
default-insertable: T has a default constructor. More precisely, T is default-insertable into X means that the following expression is well-formed: allocator_traits<A>construct(m, p)
move-insertable: T provides a constructor that takes an rvalue of type (non-'const') T. More precisely, T is move-insertable into X means that the following expression is well-formed: allocator_traits<A>construct(m, p, rv)
copy-insertable: T provides a constructor that takes an lvalue or rvalue of type (possibly const) T. More precisely, T is copy-insertable into X means that the following expression is well-formed: allocator_traits<A>construct(m, p, v)
move-assignable: T provides an assignment operator that takes an rvalue of type (non-'const') T.
copy-assignable: T provides an assignment operator that takes an lvalue or rvalue of type (possibly const) T.
emplace-constructible: T is emplace-constructible into X from args means that the following expression is well-formed: allocator_traits<A>construct(m, p, args)
erasable: T provides a destructor. More precisely, T is erasable from X means that the following expression is well-formed: allocator_traits<A>destroy(m, p)
equality-comparable: The type provides an equality-comparison operator that defines an equivalence relationship and is both reflexive and transitive.
Memory Allocation:
The type supplied as a deque's ALLOCATOR template parameter determines how that deque will allocate memory. The deque template supports allocators meeting the requirements of the C++03 standard, in addition it supports scoped-allocators derived from the bslma::Allocator memory allocation protocol. Clients intending to use bslma style allocators should use the template's default ALLOCATOR type: The default type for the ALLOCATOR template parameter, bsl::allocator, provides a C++11 standard-compatible adapter for a bslma::Allocator object.
bslma-Style Allocators:
If the (template parameter) type ALLOCATOR of a deque instantiation' is bsl::allocator, then objects of that deque type will conform to the standard behavior of a bslma-allocator-enabled type. Such a deque accepts an optional bslma::Allocator argument at construction. If the address of a bslma::Allocator object is explicitly supplied at construction, it is used to supply memory for the deque throughout its lifetime; otherwise, the deque will use the default allocator installed at the time of the deque's construction (see bslma_default). In addition to directly allocating memory from the indicated bslma::Allocator, a deque supplies that allocator's address to the constructors of contained objects of the (template parameter) VALUE_TYPE if it defines the bslma::UsesBslmaAllocator trait.
Operations:
This section describes the run-time complexity of operations on instances of deque:
  Legend
  ------
  'V'                - (template parameter) 'VALUE_TYPE' of the deque
  'a', 'b'           - two distinct objects of type 'deque<V>'
  'rv'               - modifiable rvalue of type 'deque<V>'
  'n', 'm'           - number of elements in 'a' and 'b', respectively
  'i'                - valid index into the deque
  'k'                - non-negative integer
  'al                - an STL-style memory allocator
  'i1', 'i2'         - two iterators defining a sequence of 'V' objects
  'il'               - object of type 'std::initializer_list<V>'
  'lil'              - length of 'il'
  'vt'               - object of type 'VALUE_TYPE'
  'rvt'              - modifiable rvalue of type 'VALUE_TYPE'
  'p1', 'p2'         - two 'const_iterator's belonging to 'a'
  'distance(i1, i2)' - number of elements in the range '[i1 .. i2)'
  'minHalf(p1)'      - 'min(distance(a.begin(), p1), distance(p1, a.end()))'
  'args'             - 0 or more arguments

  |-----------------------------------------+-------------------------------|
  | Operation                               | Complexity                    |
  |=========================================+===============================|
  | deque<V> a       (default construction) | O[1]                          |
  | deque<V> a(al)                          |                               |
  |-----------------------------------------+-------------------------------|
  | deque<V> a(b)    (copy construction)    | O[n]                          |
  | deque<V> a(b, al)                       |                               |
  |-----------------------------------------+-------------------------------|
  | deque<V> a(rv)   (move construction)    | O[1] if 'a' and 'rv' use the  |
  | deque<V> a(rv, al)                      | same allocator; O[n] otherwise|
  |-----------------------------------------+-------------------------------|
  | deque<V> a(k)                           | O[k]                          |
  | deque<V> a(k, al)                       |                               |
  |-----------------------------------------+-------------------------------|
  | deque<V> a(k, vt)                       | O[k]                          |
  | deque<V> a(k, vt, al)                   |                               |
  |-----------------------------------------+-------------------------------|
  | deque<V> a(i1, i2)                      | O[distance(i1, i2)]           |
  | deque<V> a(i1, i2, al)                  |                               |
  |-----------------------------------------+-------------------------------|
  | deque<V> a(il)                          | O[lil]                        |
  | deque<V> a(il, al)                      |                               |
  |-----------------------------------------+-------------------------------|
  | a.~deque<V>()   (destruction)           | O[n]                          |
  |-----------------------------------------+-------------------------------|
  | a.assign(k, vt)                         | O[k]                          |
  |-----------------------------------------+-------------------------------|
  | a.assign(i1, i2)                        | O[distance(i1, i2)]           |
  |-----------------------------------------+-------------------------------|
  | a.assign(il)                            | O[lil]                        |
  |-----------------------------------------+-------------------------------|
  | get_allocator()                         | O[1]                          |
  |-----------------------------------------+-------------------------------|
  | a.begin(), a.end()                      | O[1]                          |
  | a.cbegin(), a.cend()                    |                               |
  | a.rbegin(), a.rend()                    |                               |
  | a.crbegin(), a.crend()                  |                               |
  |-----------------------------------------+-------------------------------|
  | a.size()                                | O[1]                          |
  |-----------------------------------------+-------------------------------|
  | a.max_size()                            | O[1]                          |
  |-----------------------------------------+-------------------------------|
  | a.resize(k)                             | O[k]                          |
  | a.resize(k, vt)                         |                               |
  |-----------------------------------------+-------------------------------|
  | a.empty()                               | O[1]                          |
  |-----------------------------------------+-------------------------------|
  | a.reserve(k)                            | O[k]                          |
  |-----------------------------------------+-------------------------------|
  | a.shrink_to_fit()                       | O[n]                          |
  |-----------------------------------------+-------------------------------|
  | a[i]                                    | O[1]                          |
  |-----------------------------------------+-------------------------------|
  | a.at(i)                                 | O[1]                          |
  |-----------------------------------------+-------------------------------|
  | a.front()                               | O[1]                          |
  |-----------------------------------------+-------------------------------|
  | a.back()                                | O[1]                          |
  |-----------------------------------------+-------------------------------|
  | a.push_back(vt)                         | O[1]                          |
  | a.push_front(vt)                        |                               |
  |-----------------------------------------+-------------------------------|
  | a.push_back(rvt)                        | O[1]                          |
  | a.push_front(rvt)                       |                               |
  |-----------------------------------------+-------------------------------|
  | a.pop_back()                            | O[1]                          |
  | a.pop_front()                           |                               |
  |-----------------------------------------+-------------------------------|
  | a.emplace_back(args)                    | O[1]                          |
  | a.emplace_front(args)                   |                               |
  |-----------------------------------------+-------------------------------|
  | a.emplace(p1, args)                     | O[1 + minHalf(p1)]            |
  |-----------------------------------------+-------------------------------|
  | a.insert(p1, vt)                        | O[1 + minHalf(p1)]            |
  |-----------------------------------------+-------------------------------|
  | a.insert(p1, rvt)                       | O[1 + minHalf(p1)]            |
  |-----------------------------------------+-------------------------------|
  | a.insert(p1, k, vt)                     | O[k + minHalf(p1)]            |
  |-----------------------------------------+-------------------------------|
  | a.insert(p1, i1, i2)                    | O[distance(i1, i2)            |
  |                                         |                + minHalf(p1)] |
  |-----------------------------------------+-------------------------------|
  | a.insert(p1, il)                        | O[lil + minHalf(p1)]          |
  |-----------------------------------------+-------------------------------|
  | a.erase(p1)                             | O[1 + minHalf(p1)]            |
  |-----------------------------------------+-------------------------------|
  | a.erase(p1, p2)                         | O[distance(p1, p2)            |
  |                                         |  + min(distance(a.begin, p1), |
  |                                         |        distance(p2, a.end())] |
  |-----------------------------------------+-------------------------------|
  | a.swap(b), swap(a, b)                   | O[1] if 'a' and 'b' use the   |
  |                                         | same allocator; O[n + m]      |
  |                                         | otherwise                     |
  |-----------------------------------------+-------------------------------|
  | a.clear()                               | O[n]                          |
  |-----------------------------------------+-------------------------------|
  | a = b;           (copy assignment)      | O[n]                          |
  |-----------------------------------------+-------------------------------|
  | a = rv;          (move assignment)      | O[1] if 'a' and 'rv' use the  |
  |                                         | same allocator; O[n] otherwise|
  |-----------------------------------------+-------------------------------|
  | a = il;                                 | O[lil]                        |
  |-----------------------------------------+-------------------------------|
  | a == b, a != b                          | O[n]                          |
  |-----------------------------------------+-------------------------------|
  | a < b, a <= b, a > b, a >= b            | O[n]                          |
  |-----------------------------------------+-------------------------------|
Exceptional Behavior:
Since this component is below the BSL STL, we centralize all the exceptional behavior into a bslstl::StdExceptUtil class, which has a dual purpose:
  • Remove the dependency of this header on the <exception> header, so that this implementation can offer an exception handler with the native exceptions, and so that all the C-strings may be defined in a single library (bsl) and not in all the translation units including this header.
  • Allow installation of exception handlers at a higher level to throw BSL STL exceptions (which differ from the native exceptions) and thus establish a full standard compliance for this component when used as bsl::deque in the BSL STL.
Usage:
In this section we show intended usage of this component.
Example 1: Using a deque to Implement a Laundry Queue:
Suppose we want to define a class to maintain a process queue of names of customers who are dropping off their laundry at a drop-off laundry service. We can accomplish this by defining a new class characterizing a laundry-process queue that uses bsl::deque in its implementation.
The process queue provides two methods, push and expeditedPush, for inserting names of customers onto the queue. When calling the push method, the customer's name will be inserted at the back of the queue -- his laundry will be done after the laundry of customers previously on the queue. The expeditedPush method is reserved for customers who have bribed the merchant for expedited service. When calling the expeditedPush method, the customer's name will be inserted onto the front of the queue -- his laundry will be done before customers previously on the queue.
When the workers are ready to do some laundry, they call the next method of the queue, which returns the name of the customer whose laundry is to be done next. For brevity of the usage example, we do not show how customers are track while or after their laundry is being done.
In addition, the laundry queue also provides the find method, which returns a bool to indicate whether a given customer is still in the queue.
First, we declare a class LaundryQueue based on a deque, to store names of customers at a drop-off laundry:
  class LaundryQueue {
      // This 'class' keeps track of customers enqueued to have their laundry
      // done by a laundromat.

      // DATA
      bsl::deque<bsl::string> d_queue;

    public:
      // CREATORS
      LaundryQueue(bslma::Allocator *basicAllocator = 0);
          // Create a 'LaundryQueue' object using the specified
          // 'basicAllocator'.  If 'basicAllocator' is not provided, use the
          // default allocator.

      // MANIPULATORS
      void push(const bsl::string& customerName);
          // Add the specified 'customerName' to the back of the laundry
          // queue.

      void expeditedPush(const bsl::string& customerName);
          // Add the specified 'customerName' to the laundry queue at the
          // front.

      bsl::string next();
          // Return the name from the front of the queue, removing it from
          // the queue.  If the queue is empty, return '(* empty *)' which is
          // not a valid name for a customer.

      // ACCESSORS
      bool find(const bsl::string& customerName);
          // Return 'true' if 'customerName' is in the queue, and 'false'
          // otherwise.
  };
Then, we define the implementation of the methods of LaundryQueue
  // CREATORS
  LaundryQueue::LaundryQueue(bslma::Allocator *basicAllocator)
  : d_queue(basicAllocator)
  {
      // Note that the allocator is propagated to the underlying 'deque',
      // which will use the default allocator is '0 == basicAllocator'.
  }

  // MANIPULATORS
  void LaundryQueue::push(const bsl::string& customerName)
  {
      d_queue.push_back(customerName);     // note constant time
  }

  void LaundryQueue::expeditedPush(const bsl::string& customerName)
  {
      d_queue.push_front(customerName);    // note constant time
  }

  bsl::string LaundryQueue::next()
  {
      if (d_queue.empty()) {
          return "(* empty *)";
      }

      bsl::string ret = d_queue.front();   // note constant time

      d_queue.pop_front();                 // note constant time

      return ret;
  }

  // ACCESSORS
  bool LaundryQueue::find(const bsl::string& customerName)
  {
      // Note 'd_queue.empty() || d_queue[0] == d_queue.front()'

      for (size_t i = 0; i < d_queue.size(); ++i) {
          if (customerName == d_queue[i]) {    // note '[]' is constant time
              return true;
          }
      }

      return false;
  }

Typedef Documentation

template<class VALUE_TYPE>
typedef VALUE_TYPE& bsl::Deque_Base< VALUE_TYPE >::reference [inherited]
template<class VALUE_TYPE>
typedef const VALUE_TYPE& bsl::Deque_Base< VALUE_TYPE >::const_reference [inherited]
template<class VALUE_TYPE>
typedef Iterator bsl::Deque_Base< VALUE_TYPE >::iterator [inherited]
template<class VALUE_TYPE>
typedef ConstIterator bsl::Deque_Base< VALUE_TYPE >::const_iterator [inherited]
template<class VALUE_TYPE>
typedef std::size_t bsl::Deque_Base< VALUE_TYPE >::size_type [inherited]
template<class VALUE_TYPE>
typedef std::ptrdiff_t bsl::Deque_Base< VALUE_TYPE >::difference_type [inherited]
template<class VALUE_TYPE>
typedef VALUE_TYPE bsl::Deque_Base< VALUE_TYPE >::value_type [inherited]
template<class VALUE_TYPE>
typedef bsl::reverse_iterator<Iterator> bsl::Deque_Base< VALUE_TYPE >::reverse_iterator [inherited]
template<class VALUE_TYPE>
typedef bsl::reverse_iterator<ConstIterator> bsl::Deque_Base< VALUE_TYPE >::const_reverse_iterator [inherited]
template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef VALUE_TYPE& bsl::deque< VALUE_TYPE, ALLOCATOR >::reference [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef const VALUE_TYPE& bsl::deque< VALUE_TYPE, ALLOCATOR >::const_reference [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef Iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::iterator [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef ConstIterator bsl::deque< VALUE_TYPE, ALLOCATOR >::const_iterator [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef std::size_t bsl::deque< VALUE_TYPE, ALLOCATOR >::size_type [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef std::ptrdiff_t bsl::deque< VALUE_TYPE, ALLOCATOR >::difference_type [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef VALUE_TYPE bsl::deque< VALUE_TYPE, ALLOCATOR >::value_type [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef ALLOCATOR bsl::deque< VALUE_TYPE, ALLOCATOR >::allocator_type [inherited]
template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef AllocatorTraits::pointer bsl::deque< VALUE_TYPE, ALLOCATOR >::pointer [inherited]
template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef AllocatorTraits::const_pointer bsl::deque< VALUE_TYPE, ALLOCATOR >::const_pointer [inherited]
template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef bsl::reverse_iterator<Iterator> bsl::deque< VALUE_TYPE, ALLOCATOR >::reverse_iterator [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
typedef bsl::reverse_iterator<ConstIterator> bsl::deque< VALUE_TYPE, ALLOCATOR >::const_reverse_iterator [inherited]

Reimplemented from bsl::Deque_Base< VALUE_TYPE >.


Function Documentation

static void bsl::Deque_Util::swap ( void *  a,
void *  b 
) [static, inherited]

Exchange the value of the specified a deque with that of the specified b deque.

template<class VALUE_TYPE>
iterator bsl::Deque_Base< VALUE_TYPE >::begin (  )  [inherited]

Return an iterator providing modifiable access to the first element in this deque, and the past-the-end iterator if this deque is empty.

template<class VALUE_TYPE>
iterator bsl::Deque_Base< VALUE_TYPE >::end (  )  [inherited]

Return the past-the-end (forward) iterator providing modifiable access to this deque.

template<class VALUE_TYPE>
reverse_iterator bsl::Deque_Base< VALUE_TYPE >::rbegin (  )  [inherited]

Return a reverse iterator providing modifiable access to the last element in this deque, and the past-the-end reverse iterator if this deque is empty.

template<class VALUE_TYPE>
reverse_iterator bsl::Deque_Base< VALUE_TYPE >::rend (  )  [inherited]

Return the past-the-end reverse iterator providing modifiable access to this deque.

template<class VALUE_TYPE>
reference bsl::Deque_Base< VALUE_TYPE >::operator[] ( size_type  position  )  [inherited]

Return a reference providing modifiable access to the element at the specified position in this deque. The behavior is undefined unless position < size().

template<class VALUE_TYPE>
reference bsl::Deque_Base< VALUE_TYPE >::at ( size_type  position  )  [inherited]

Return a reference providing modifiable access to the element at the specified position in this deque. Throw a std::out_of_range exception if position >= size().

template<class VALUE_TYPE>
reference bsl::Deque_Base< VALUE_TYPE >::front (  )  [inherited]

Return a reference providing modifiable access to the first element in this deque. The behavior is undefined unless this deque is not empty.

template<class VALUE_TYPE>
reference bsl::Deque_Base< VALUE_TYPE >::back (  )  [inherited]

Return a reference providing modifiable access to the last element in this deque. The behavior is undefined unless this deque is not empty.

template<class VALUE_TYPE>
const_iterator bsl::Deque_Base< VALUE_TYPE >::begin (  )  const [inherited]
template<class VALUE_TYPE>
const_iterator bsl::Deque_Base< VALUE_TYPE >::cbegin (  )  const [inherited]

Return an iterator providing non-modifiable access to the first element in this deque, and the past-the-end iterator if this deque is empty.

template<class VALUE_TYPE>
const_iterator bsl::Deque_Base< VALUE_TYPE >::end (  )  const [inherited]
template<class VALUE_TYPE>
const_iterator bsl::Deque_Base< VALUE_TYPE >::cend (  )  const [inherited]

Return the past-the-end (forward) iterator providing non-modifiable access to this deque.

template<class VALUE_TYPE>
const_reverse_iterator bsl::Deque_Base< VALUE_TYPE >::rbegin (  )  const [inherited]
template<class VALUE_TYPE>
const_reverse_iterator bsl::Deque_Base< VALUE_TYPE >::crbegin (  )  const [inherited]

Return a reverse iterator providing non-modifiable access to the last element in this deque, and the past-the-end reverse iterator if this deque is empty.

template<class VALUE_TYPE>
const_reverse_iterator bsl::Deque_Base< VALUE_TYPE >::rend (  )  const [inherited]
template<class VALUE_TYPE>
const_reverse_iterator bsl::Deque_Base< VALUE_TYPE >::crend (  )  const [inherited]

Return the past-the-end reverse iterator providing non-modifiable access to this deque.

template<class VALUE_TYPE>
size_type bsl::Deque_Base< VALUE_TYPE >::size (  )  const [inherited]

Return the number of elements contained by this deque.

template<class VALUE_TYPE>
size_type bsl::Deque_Base< VALUE_TYPE >::capacity (  )  const [inherited]

Return the sum of the current size of this deque plus the minimum number of push_front or push_back operations needed to invalidate iterators in this deque. Note that this method is not part of the C++ standard.

template<class VALUE_TYPE>
bool bsl::Deque_Base< VALUE_TYPE >::empty (  )  const [inherited]

Return true if this deque contains no elements, and false otherwise.

template<class VALUE_TYPE>
const_reference bsl::Deque_Base< VALUE_TYPE >::operator[] ( size_type  position  )  const [inherited]

Return a reference providing non-modifiable access to the element at the specified position in this deque. The behavior is undefined unless position < size().

template<class VALUE_TYPE>
const_reference bsl::Deque_Base< VALUE_TYPE >::at ( size_type  position  )  const [inherited]

Return a reference providing non-modifiable access to the element at the specified position in this deque. Throw a std::out_of_range exception if position >= size().

template<class VALUE_TYPE>
const_reference bsl::Deque_Base< VALUE_TYPE >::front (  )  const [inherited]

Return a reference providing non-modifiable access to the first element in this deque. The behavior is undefined unless this deque is not empty.

template<class VALUE_TYPE>
const_reference bsl::Deque_Base< VALUE_TYPE >::back (  )  const [inherited]

Return a reference providing non-modifiable access to the last element in this deque. The behavior is undefined unless this deque is not empty.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque (  )  [inherited]
template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( const ALLOCATOR &  basicAllocator  )  [explicit, inherited]

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.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( size_type  numElements,
const ALLOCATOR &  basicAllocator = ALLOCATOR() 
) [explicit, inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( size_type  numElements,
const VALUE_TYPE &  value,
const ALLOCATOR &  basicAllocator = ALLOCATOR() 
) [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
template<class INPUT_ITERATOR >
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( INPUT_ITERATOR  first,
INPUT_ITERATOR  last,
const ALLOCATOR &  basicAllocator = ALLOCATOR() 
) [inherited]

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). The behavior is undefined unless first and last refer to a sequence of valid values where first is at a position at or before last.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( const deque< VALUE_TYPE, ALLOCATOR > &  original  )  [inherited]

Create a deque that has the same value as the specified original object. Use the allocator returned by 'bslallocator_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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( const deque< VALUE_TYPE, ALLOCATOR > &  original,
const typename type_identity< ALLOCATOR >::type basicAllocator 
) [inherited]

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). Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) type ALLOCATOR is bsl::allocator (the default).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( BloombergLP::bslmf::MovableRef< deque< VALUE_TYPE, ALLOCATOR > >  original  )  [inherited]

IMPLICIT: 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.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( BloombergLP::bslmf::MovableRef< deque< VALUE_TYPE, ALLOCATOR > >  original,
const typename type_identity< ALLOCATOR >::type basicAllocator 
) [inherited]

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). Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) ALLOCATOR is bsl::allocator (the default).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::deque ( std::initializer_list< value_type values,
const ALLOCATOR &  basicAllocator = ALLOCATOR() 
) [inherited]

Create a deque and append each value_type object in the specified values initializer list. 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. This method requires that the (template parameter) VALUE_TYPE be copy-insertable into this deque (see Requirements on VALUE_TYPE).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
bsl::deque< VALUE_TYPE, ALLOCATOR >::~deque (  )  [inherited]

Destroy this object.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
deque& bsl::deque< VALUE_TYPE, ALLOCATOR >::operator= ( const deque< VALUE_TYPE, ALLOCATOR > &  rhs  )  [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
deque& operator= (BloombergLP::bslmf::MovableRef<deque> rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION( AllocatorTraits deque& bsl::deque< VALUE_TYPE, ALLOCATOR >::operator= ( std::initializer_list< value_type values  )  [inherited]

< 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 object the value resulting from first clearing this deque and then appending each value_type object in the specified values initializer list; return a reference providing modifiable access to this object. This method requires that the (template parameter) VALUE_TYPE be copy-insertable into this deque (see Requirements on VALUE_TYPE).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
template<class INPUT_ITERATOR >
void bsl::deque< VALUE_TYPE, ALLOCATOR >::assign ( INPUT_ITERATOR  first,
INPUT_ITERATOR  last 
) [inherited]

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). The behavior is undefined unless first and last refer to a sequence of valid values where first is at a position at or before last.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::assign ( size_type  numElements,
const VALUE_TYPE &  value 
) [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::assign ( std::initializer_list< value_type values  )  [inherited]

Assign to this object the value resulting from first clearing this deque and then appending each value_type object in the specified values initializer list. This method requires that the (template parameter) VALUE_TYPE be copy-assignable and copy-insertable into this deque (see Requirements on VALUE_TYPE).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::reserve ( size_type  numElements  )  [inherited]

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. Note that inserting elements into the deque may still incur memory allocation. Also note that this method, if it has any effect, will invalidate iterators initialized prior to the call. Also note that this method is not part of the C++ standard.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::resize ( size_type  newSize  )  [inherited]
template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::resize ( size_type  newSize,
const VALUE_TYPE &  value 
) [inherited]

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().

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::shrink_to_fit (  )  [inherited]

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. Note that this method has no effect on the memory used by individual elements of the (template parameter) VALUE_TYPE.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::push_front ( const VALUE_TYPE &  value  )  [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::push_front ( BloombergLP::bslmf::MovableRef< value_type value  )  [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::push_back ( const VALUE_TYPE &  value  )  [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::push_back ( BloombergLP::bslmf::MovableRef< value_type value  )  [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
template<class... Args>
reference bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace_front ( Args &&...  arguments  )  [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
template<class... Args>
reference bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace_back ( Args &&...  arguments  )  [inherited]

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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
template<class... Args>
iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::emplace ( const_iterator  position,
Args &&...  arguments 
) [inherited]

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). The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()] (both endpoints included).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::pop_front (  )  [inherited]

Erase the first element from this deque. The behavior is undefined if this deque is empty.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void bsl::deque< VALUE_TYPE, ALLOCATOR >::pop_back (  )  [inherited]

Erase the last element from this deque. The behavior is undefined if this deque is empty.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert ( const_iterator  position,
const VALUE_TYPE &  value 
) [inherited]

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). The behavior is undefined unless position is an iterator in the range '[cbegin() .. cend()] (both endpoints included)'.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert ( const_iterator  position,
BloombergLP::bslmf::MovableRef< value_type value 
) [inherited]

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). The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()] (both endpoints included).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert ( const_iterator  position,
size_type  numElements,
const VALUE_TYPE &  value 
) [inherited]

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). The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()] (both endpoints included).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
template<class INPUT_ITERATOR >
iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert ( const_iterator  position,
INPUT_ITERATOR  first,
INPUT_ITERATOR  last 
) [inherited]

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). The behavior is undefined unless 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.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::insert ( const_iterator  position,
std::initializer_list< value_type values 
) [inherited]

Insert at the specified position in this deque the value of each value_type object in the specified values initializer list, 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). The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()] (both endpoints included).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::erase ( const_iterator  position  )  [inherited]

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. The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
iterator bsl::deque< VALUE_TYPE, ALLOCATOR >::erase ( const_iterator  first,
const_iterator  last 
) [inherited]

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. The behavior is undefined unless 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).

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
allocator_type bsl::deque< VALUE_TYPE, ALLOCATOR >::get_allocator (  )  const [inherited]

Return the allocator used by this deque to supply memory.

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
size_type bsl::deque< VALUE_TYPE, ALLOCATOR >::max_size (  )  const [inherited]

Return the maximum possible size of this deque. Note that this is a theoretical maximum (such as the maximum value that can be held by 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.

template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator== ( const deque< VALUE_TYPE, ALLOCATOR > &  lhs,
const deque< VALUE_TYPE, ALLOCATOR > &  rhs 
)

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two deque objects lhs and rhs have the same value if they have the same number of elements, and each element in the ordered sequence of elements of lhs has the same value as the corresponding element in the ordered sequence of elements of rhs. This method requires that the (template parameter) type VALUE_TYPE be equality-comparable (see Requirements on VALUE_TYPE).

template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator!= ( const deque< VALUE_TYPE, ALLOCATOR > &  lhs,
const deque< VALUE_TYPE, ALLOCATOR > &  rhs 
)

Return true if the specified lhs and rhs objects do not have the same value, and false otherwise. Two deque objects lhs and rhs do not have the same value if they do not have the same number of elements, or some element in the ordered sequence of elements of lhs does not have the same value as the corresponding element in the ordered sequence of elements of rhs. This method requires that the (template parameter) type VALUE_TYPE be equality-comparable (see Requirements on VALUE_TYPE).

template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator< ( const deque< VALUE_TYPE, ALLOCATOR > &  lhs,
const deque< VALUE_TYPE, ALLOCATOR > &  rhs 
)

Return true if the value of the specified lhs deque is lexicographically less than that of the specified rhs deque, and false otherwise. Given iterators i and j over the respective sequences [lhs.begin() .. lhs.end()) and [rhs.begin() .. rhs.end()), the value of deque lhs is lexicographically less than that of deque rhs if true == *i < *j for the first pair of corresponding iterator positions where *i < *j and *j < *i are not both false. If no such corresponding iterator position exists, the value of lhs is lexicographically less than that of rhs if lhs.size() < rhs.size(). This method requires that operator<, inducing a total order, be defined for value_type.

template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator> ( const deque< VALUE_TYPE, ALLOCATOR > &  lhs,
const deque< VALUE_TYPE, ALLOCATOR > &  rhs 
)

Return true if the value of the specified lhs deque is lexicographically greater than that of the specified rhs deque, and false otherwise. The value of deque lhs is lexicographically greater than that of deque rhs if rhs is lexicographically less than lhs (see operator<). This method requires that operator<, inducing a total order, be defined for value_type. Note that this operator returns rhs < lhs.

template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator<= ( const deque< VALUE_TYPE, ALLOCATOR > &  lhs,
const deque< VALUE_TYPE, ALLOCATOR > &  rhs 
)

Return true if the value of the specified lhs deque is lexicographically less than or equal to that of the specified rhs deque, and false otherwise. The value of deque lhs is lexicographically less than or equal to that of deque rhs if rhs is not lexicographically less than lhs (see operator<). This method requires that operator<, inducing a total order, be defined for value_type. Note that this operator returns !(rhs < lhs).

template<class VALUE_TYPE , class ALLOCATOR >
bool bsl::operator>= ( const deque< VALUE_TYPE, ALLOCATOR > &  lhs,
const deque< VALUE_TYPE, ALLOCATOR > &  rhs 
)

Return true if the value of the specified lhs deque is lexicographically greater than or equal to that of the specified rhs deque, and false otherwise. The value of deque lhs is lexicographically greater than or equal to that of deque rhs if lhs is not lexicographically less than rhs (see operator<). This method requires that operator<, inducing a total order, be defined for value_type. Note that this operator returns !(lhs < rhs).

template<class VALUE_TYPE , class ALLOCATOR , class BDE_OTHER_TYPE >
deque<VALUE_TYPE, ALLOCATOR>::size_type bsl::erase ( deque< VALUE_TYPE, ALLOCATOR > &  deq,
const BDE_OTHER_TYPE &  value 
)

Erase all the elements in the specified deque deq that compare equal to the specified value. Return the number of elements erased.

Referenced by bsl::list< KEY >::assign().

template<class VALUE_TYPE , class ALLOCATOR , class PREDICATE >
deque<VALUE_TYPE, ALLOCATOR>::size_type bsl::erase_if ( deque< VALUE_TYPE, ALLOCATOR > &  deq,
PREDICATE  predicate 
)

Erase all the elements in the specified deque deq that satisfy the specified predicate predicate. Return the number of elements erased.

template<class VALUE_TYPE , class ALLOCATOR >
void bsl::swap ( deque< VALUE_TYPE, ALLOCATOR > &  a,
deque< VALUE_TYPE, ALLOCATOR > &  b 
)

Exchange the value of the specified a object with that of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee. This operation has O[1] complexity if either a was created with the same allocator as b 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 a and b, respectively. Note that this function's support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.

Referenced by bsl::vector< ThreadUtil::Handle >::emplace().

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_BlockCreator< VALUE_TYPE, ALLOCATOR >::Deque_BlockCreator ( deque< VALUE_TYPE, ALLOCATOR > *  deque  )  [explicit, inherited]

Construct a block allocator for the specified deque.

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_BlockCreator< VALUE_TYPE, ALLOCATOR >::~Deque_BlockCreator (  )  [inherited]

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

template<class VALUE_TYPE , class ALLOCATOR >
void bsl::Deque_BlockCreator< VALUE_TYPE, ALLOCATOR >::insertAtFront ( size_type  n  )  [inherited]

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.

template<class VALUE_TYPE , class ALLOCATOR >
void bsl::Deque_BlockCreator< VALUE_TYPE, ALLOCATOR >::insertAtBack ( size_type  n  )  [inherited]

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.

template<class VALUE_TYPE , class ALLOCATOR >
BlockPtr* bsl::Deque_BlockCreator< VALUE_TYPE, ALLOCATOR >::reserveBlockSlots ( size_type  numNewBlocks,
bool  atFront 
) [inherited]

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.

template<class VALUE_TYPE , class ALLOCATOR >
void bsl::Deque_BlockCreator< VALUE_TYPE, ALLOCATOR >::release (  )  [inherited]

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

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_BlockProctor< VALUE_TYPE, ALLOCATOR >::Deque_BlockProctor ( deque< VALUE_TYPE, ALLOCATOR > *  deque,
bool  atFront 
) [inherited]

Create a block proctor object to proctor blocks at one end (i.e., front or back) of the specified deque as indicated by the specified atFront flag. If atFront is true, blocks at the front of deque are proctored; otherwise, blocks at the back of deque are proctored.

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_BlockProctor< VALUE_TYPE, ALLOCATOR >::~Deque_BlockProctor (  )  [inherited]

Destroy this block proctor, and deallocate empty blocks at the back of the proctored deque as indicated by the atFront flag supplied at construction. If no deque is currently being managed, this method has no effect.

template<class VALUE_TYPE , class ALLOCATOR >
void bsl::Deque_BlockProctor< VALUE_TYPE, ALLOCATOR >::release (  )  [inherited]

Release from management the deque currently managed by this proctor. If no deque is currently being managed, this method has no effect.

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_ClearGuard< VALUE_TYPE, ALLOCATOR >::Deque_ClearGuard ( deque< VALUE_TYPE, ALLOCATOR > *  deque  )  [explicit, inherited]

Create a clear guard object to proctor the specified deque.

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_ClearGuard< VALUE_TYPE, ALLOCATOR >::~Deque_ClearGuard (  )  [inherited]

Destroy this guard, and call clear on the deque supplied at construction, unless release has been called on this object.

template<class VALUE_TYPE , class ALLOCATOR >
void bsl::Deque_ClearGuard< VALUE_TYPE, ALLOCATOR >::release (  )  [inherited]

Release from management the deque proctored by this object.

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::Deque_Guard ( deque< VALUE_TYPE, ALLOCATOR > *  deque,
bool  isTail 
) [inherited]

Initializes object to guard 0 items from the specified deque. This guards either the tail or the head, as determined by the specified isTail boolean.

template<class VALUE_TYPE , class ALLOCATOR >
bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::~Deque_Guard (  )  [inherited]

Call the (template parameter) VALUE_TYPE destructor on objects in the range [d.end() .. d.end() + count()) if isTail was specified as true during construction, or [d.start() - count() .. d.start()] if isTail was specified as false during construction, where d is the deque used to construct this guard.

template<class VALUE_TYPE , class ALLOCATOR >
std::size_t bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::operator++ (  )  [inherited]

Increment the count of this guard, and return the new count.

template<class VALUE_TYPE , class ALLOCATOR >
std::size_t bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::operator-- (  )  [inherited]

Decrement the count of this guard, and return the new count.

template<class VALUE_TYPE , class ALLOCATOR >
void bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::release (  )  [inherited]

Set the count of this guard to 0. Note that this guard's destructor will do nothing if count is not incremented again after this call.

template<class VALUE_TYPE , class ALLOCATOR >
std::size_t bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::count (  )  const [inherited]

Return the current count maintained by this guard.

template<class VALUE_TYPE , class ALLOCATOR >
IteratorImp bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::begin (  )  const [inherited]

Return a pointer after the first item in the guarded range.

template<class VALUE_TYPE , class ALLOCATOR >
IteratorImp bsl::Deque_Guard< VALUE_TYPE, ALLOCATOR >::end (  )  const [inherited]

Return a pointer after the last item in the guarded range.


Variable Documentation

template<class VALUE_TYPE>
BlockPtr* bsl::Deque_Base< VALUE_TYPE >::d_blocks_p [protected, inherited]

array of pointer to blocks (owned)

template<class VALUE_TYPE>
std::size_t bsl::Deque_Base< VALUE_TYPE >::d_blocksLength [protected, inherited]

length of d_blocks_p array

template<class VALUE_TYPE>
IteratorImp bsl::Deque_Base< VALUE_TYPE >::d_start [protected, inherited]

iterator to first element

template<class VALUE_TYPE>
IteratorImp bsl::Deque_Base< VALUE_TYPE >::d_finish [protected, inherited]

iterator to one past last element

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
void swap (deque<VALUE_TYPE, ALLOCATOR>& other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION( AllocatorTraits void bsl::deque< VALUE_TYPE, ALLOCATOR >::clear() BSLS_KEYWORD_NOEXCEPT [inherited]

< 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. Note that this method's support for swapping objects created with different allocators when ALLOCATOR 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. Note that although this deque is empty after this method returns, it preserves the same capacity it had before the method was called.


Friends

template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
friend class Deque_BlockCreator [friend, inherited]
template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
friend class Deque_BlockProctor [friend, inherited]
template<class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE>>
friend class Deque_Guard [friend, inherited]