Quick Links:

bal | bbl | bdl | bsl

Classes | Typedefs | Functions | Variables | Friends

Component bslstl_list
[Package bslstl]

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

Classes

class  bsl::List_Node< VALUE >
class  bsl::List_Iterator< VALUE >
struct  bsl::List_DefaultLessThan< VALUE >
class  bsl::List_AllocAndSizeWrapper< VALUE, ALLOCATOR >
class  bsl::List_NodeProctor< VALUE, ALLOCATOR >
class  bsl::list< VALUE, ALLOCATOR >

Typedefs

typedef
std::bidirectional_iterator_tag 
bsl::List_Iterator::iterator_category
typedef NcType bsl::List_Iterator::value_type
typedef
BloombergLP::bsls::Types::IntPtr 
bsl::List_Iterator::difference_type
typedef VALUE * bsl::List_Iterator::pointer
typedef VALUE & bsl::List_Iterator::reference
typedef AllocTraits::pointer bsl::List_NodeProctor::NodePtr
typedef VALUE & bsl::list::reference
typedef const VALUE & bsl::list::const_reference
typedef List_Iterator< VALUE > bsl::list::iterator
typedef List_Iterator< const
VALUE > 
bsl::list::const_iterator
typedef allocator_traits
< ALLOCATOR >::pointer 
bsl::list::pointer
typedef allocator_traits
< ALLOCATOR >::const_pointer 
bsl::list::const_pointer
typedef allocator_traits
< ALLOCATOR >::size_type 
bsl::list::size_type
typedef allocator_traits
< ALLOCATOR >::difference_type 
bsl::list::difference_type
typedef VALUE bsl::list::value_type
typedef ALLOCATOR bsl::list::allocator_type
typedef bsl::reverse_iterator
< iterator > 
bsl::list::reverse_iterator
typedef bsl::reverse_iterator
< const_iterator > 
bsl::list::const_reverse_iterator

Functions

 bsl::List_Iterator::List_Iterator ()
 bsl::List_Iterator::List_Iterator (Node *nodePtr)
 bsl::List_Iterator::List_Iterator (const NcIter &other)
List_Iterator & bsl::List_Iterator::operator++ ()
List_Iterator & bsl::List_Iterator::operator-- ()
List_Iterator bsl::List_Iterator::operator++ (int)
List_Iterator bsl::List_Iterator::operator-- (int)
reference bsl::List_Iterator::operator* () const
pointer bsl::List_Iterator::operator-> () const
template<class T1 , class T2 >
bool bsl::operator== (List_Iterator< T1 > lhs, List_Iterator< T2 > rhs)
template<class T1 , class T2 >
bool bsl::operator!= (List_Iterator< T1 > lhs, List_Iterator< T2 > rhs)
 bsl::List_AllocAndSizeWrapper::List_AllocAndSizeWrapper (const NodeAlloc &basicAllocator, size_type size)
size_type & bsl::List_AllocAndSizeWrapper::size ()
const size_type & bsl::List_AllocAndSizeWrapper::size () const
 bsl::List_NodeProctor::List_NodeProctor (list< VALUE, ALLOCATOR > *listPtr, NodePtr nodePtr)
 bsl::List_NodeProctor::~List_NodeProctor ()
void bsl::List_NodeProctor::release ()
 bsl::list::list ()
 bsl::list::list (const ALLOCATOR &basicAllocator)
 bsl::list::list (size_type numElements)
 bsl::list::list (size_type numElements, const ALLOCATOR &basicAllocator)
 bsl::list::list (size_type numElements, const value_type &value, const ALLOCATOR &basicAllocator=ALLOCATOR())
template<class INPUT_ITERATOR >
 bsl::list::list (INPUT_ITERATOR first, INPUT_ITERATOR last, const ALLOCATOR &basicAllocator=ALLOCATOR(), typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *=0)
 bsl::list::list (const list &original)
 bsl::list::list (const list &original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
 bsl::list::list (BloombergLP::bslmf::MovableRef< list > original)
 bsl::list::list (BloombergLP::bslmf::MovableRef< list > original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
 bsl::list::list (std::initializer_list< value_type > values, const ALLOCATOR &basicAllocator=ALLOCATOR())
 bsl::list::~list ()
list & bsl::list::operator= (const list &rhs)
list &operator=(BloombergLP::bslmf::MovableRef
< list > rhs)
BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocTraits
list & 
bsl::list::operator= (std::initializer_list< value_type > rhs)
template<class INPUT_ITERATOR >
void bsl::list::assign (INPUT_ITERATOR first, INPUT_ITERATOR last, typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *=0)
void bsl::list::assign (size_type numElements, const value_type &value)
void bsl::list::assign (std::initializer_list< value_type > values)
iterator bsl::list::begin () BSLS_KEYWORD_NOEXCEPT
iterator bsl::list::end () BSLS_KEYWORD_NOEXCEPT
reverse_iterator bsl::list::rbegin () BSLS_KEYWORD_NOEXCEPT
reverse_iterator bsl::list::rend () BSLS_KEYWORD_NOEXCEPT
void bsl::list::clear () BSLS_KEYWORD_NOEXCEPT
void bsl::list::resize (size_type newSize)
void bsl::list::resize (size_type newSize, const value_type &value)
reference bsl::list::back ()
reference bsl::list::front ()
void bsl::list::pop_back ()
void bsl::list::pop_front ()
iterator bsl::list::erase (const_iterator position)
iterator bsl::list::erase (const_iterator dstBegin, const_iterator dstEnd)
template<class... ARGS>
reference bsl::list::emplace_back (ARGS &&...arguments)
template<class... ARGS>
reference bsl::list::emplace_front (ARGS &&...arguments)
void bsl::list::push_back (const value_type &value)
void bsl::list::push_back (BloombergLP::bslmf::MovableRef< value_type > value)
void bsl::list::push_front (const value_type &value)
void bsl::list::push_front (BloombergLP::bslmf::MovableRef< value_type > value)
template<class... ARGS>
iterator bsl::list::emplace (const_iterator position, ARGS &&...arguments)
iterator bsl::list::insert (const_iterator dstPosition, const value_type &value)
iterator bsl::list::insert (const_iterator dstPosition, BloombergLP::bslmf::MovableRef< value_type > value)
iterator bsl::list::insert (const_iterator dstPosition, size_type numElements, const value_type &value)
template<class INPUT_ITERATOR >
iterator bsl::list::insert (const_iterator dstPosition, INPUT_ITERATOR first, INPUT_ITERATOR last, typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *=0)
iterator bsl::list::insert (const_iterator dstPosition, std::initializer_list< value_type > values)
void bsl::list::merge (list &other)
void bsl::list::merge (BloombergLP::bslmf::MovableRef< list > other)
template<class COMPARE >
void bsl::list::merge (list &other, COMPARE comparator)
template<class COMPARE >
void bsl::list::merge (BloombergLP::bslmf::MovableRef< list > other, COMPARE comparator)
void bsl::list::remove (const value_type &value)
template<class PREDICATE >
void bsl::list::remove_if (PREDICATE predicate)
void bsl::list::reverse () BSLS_KEYWORD_NOEXCEPT
void bsl::list::sort ()
template<class COMPARE >
void bsl::list::sort (COMPARE comparator)
void bsl::list::splice (const_iterator dstPosition, list &src)
void bsl::list::splice (const_iterator dstPosition, BloombergLP::bslmf::MovableRef< list > src)
void bsl::list::splice (const_iterator dstPosition, list &src, const_iterator srcNode)
void bsl::list::splice (const_iterator dstPosition, BloombergLP::bslmf::MovableRef< list > src, const_iterator srcNode)
void bsl::list::splice (const_iterator dstPosition, list &src, const_iterator first, const_iterator last)
void bsl::list::splice (const_iterator dstPosition, BloombergLP::bslmf::MovableRef< list > src, const_iterator first, const_iterator last)
void bsl::list::unique ()
template<class EQ_PREDICATE >
void bsl::list::unique (EQ_PREDICATE binaryPredicate)
const_iterator bsl::list::cbegin () const BSLS_KEYWORD_NOEXCEPT
const_iterator bsl::list::end () const BSLS_KEYWORD_NOEXCEPT
const_iterator bsl::list::cend () const BSLS_KEYWORD_NOEXCEPT
const_reverse_iterator bsl::list::rbegin () const BSLS_KEYWORD_NOEXCEPT
const_reverse_iterator bsl::list::crbegin () const BSLS_KEYWORD_NOEXCEPT
const_reverse_iterator bsl::list::rend () const BSLS_KEYWORD_NOEXCEPT
const_reverse_iterator bsl::list::crend () const BSLS_KEYWORD_NOEXCEPT
bool bsl::list::empty () const BSLS_KEYWORD_NOEXCEPT
size_type bsl::list::max_size () const BSLS_KEYWORD_NOEXCEPT
size_type bsl::list::size () const BSLS_KEYWORD_NOEXCEPT
const_reference bsl::list::back () const
const_reference bsl::list::front () const
allocator_type bsl::list::get_allocator () const BSLS_KEYWORD_NOEXCEPT
template<class VALUE , class ALLOCATOR >
bool bsl::operator== (const list< VALUE, ALLOCATOR > &lhs, const list< VALUE, ALLOCATOR > &rhs)
template<class VALUE , class ALLOCATOR >
bool bsl::operator!= (const list< VALUE, ALLOCATOR > &lhs, const list< VALUE, ALLOCATOR > &rhs)
template<class VALUE , class ALLOCATOR >
bool bsl::operator< (const list< VALUE, ALLOCATOR > &lhs, const list< VALUE, ALLOCATOR > &rhs)
template<class VALUE , class ALLOCATOR >
bool bsl::operator> (const list< VALUE, ALLOCATOR > &lhs, const list< VALUE, ALLOCATOR > &rhs)
template<class VALUE , class ALLOCATOR >
bool bsl::operator<= (const list< VALUE, ALLOCATOR > &lhs, const list< VALUE, ALLOCATOR > &rhs)
template<class VALUE , class ALLOCATOR >
bool bsl::operator>= (const list< VALUE, ALLOCATOR > &lhs, const list< VALUE, ALLOCATOR > &rhs)
template<class VALUE , class ALLOCATOR , class BDE_OTHER_TYPE >
list< VALUE, ALLOCATOR >::size_type bsl::erase (list< VALUE, ALLOCATOR > &l, const BDE_OTHER_TYPE &value)
template<class VALUE , class ALLOCATOR , class PREDICATE >
list< VALUE, ALLOCATOR >::size_type bsl::erase_if (list< VALUE, ALLOCATOR > &l, PREDICATE predicate)
template<class VALUE , class ALLOCATOR >
void bsl::swap (list< VALUE, ALLOCATOR > &a, list< VALUE, ALLOCATOR > &b) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b)))

Variables

void swap(list &other)
BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocTraits
const_iterator 
bsl::list::begin () const BSLS_KEYWORD_NOEXCEPT

Friends

class bsl::List_Node::list
class bsl::List_Node::List_Iterator
class bsl::List_Iterator::list
class bsl::List_Iterator::List_Iterator
class bsl::list::List_NodeProctor< VALUE, ALLOCATOR >
template<class T1 , class T2 >
bool bsl::List_Iterator::operator== (List_Iterator< T1 >, List_Iterator< T2 >)

Detailed Description

Outline
Purpose:
Provide an STL-compliant list class.
Classes:
bsl::list STL-compatible list template
Canonical Header:
bsl_list.h
See also:
Component bslstl_deque
Description:
This component defines a single class template, bsl::list, implementing the standard container holding a sequence of elements (of a template parameter type, VALUE). All list operations involving a single element are constant-time, including insertion and removal of an element anywhere in the list. Operations that do not change the number of elements are performed without calling constructors, destructors, swap, or assignment on the individual elements. (I.e., they are performed by pointer-manipulation alone.) A list does not provide random access to its elements; although access to the first and last elements of a list is constant-time, other elements can be accessed only by traversing the list (forwards or backwards) from the beginning or end.
An instantiation of list is an allocator-aware, in-core value-semantic type whose salient attributes are its size (number of elements) and the sequence of its contained element values (in order). If list is instantiated with a type that is not itself value-semantic, then it will not retain all of its value-semantic qualities. In particular, if a type cannot be tested for equality, then a list containing that type cannot be tested for equality. It is even possible to instantiate list with a type that does not have a copy-constructor, in which case the list will not be copyable.
A list meets the requirements of a sequence container with bidirectional iterators in the C++ standard [23.3]. The list 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:
A list is a fully Value-Semantic Type (see bsldoc_glossary) only if the supplied VALUE template parameter is itself fully value-semantic. It is possible to instantiate a list with a VALUE parameter argument that does not provide 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 list to describe a function's requirements for the VALUE template parameter. These terms are also defined in sections [utility.arg.requirements] and [container.requirements.general] of the C++11 standard.
Memory Allocation:
The type supplied as a list's ALLOCATOR template parameter determines how that list will allocate memory. The list template supports allocators meeting the requirements of the C++11 standard [17.6.3.5]; 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 list instantiation is bsl::allocator, then objects of that list type will conform to the standard behavior of a bslma-allocator-enabled type. Such a list accepts an optional bslma::Allocator argument at construction. If the address of a bslma::Allocator object is explicitly supplied at construction, the list uses it to supply memory for the list throughout its lifetime; otherwise, the list will use the default allocator installed at the time of the list's construction (see bslma_default). In addition to directly allocating memory from the indicated bslma::Allocator, a list supplies that allocator's address to the constructors of contained objects of the (template parameter) VALUE type if it defines the bslma::UsesBslmaAllocator trait.
Comparators and Strict Weak Ordering:
A comparator function comp(a, b) defines a strict weak ordering if
  • comp(a, b) && comp(b, c) implies comp(a, c)
  • comp(a, b) implies !comp(b, a)
  • !comp(a, b) does not imply that comp(b, a)
Glossary:
  Legend
  ------
  'X'    - denotes an allocator-aware container type (e.g., 'list')
  '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.
Operations:
This section describes the run-time complexity of operations on instances of list:
  Legend
  ------
  'V'             - template parameter 'VALUE' type of the list
  'A'             - template parameter 'ALLOCATOR' type of the list
  'a', 'b'        - distinct objects of type 'list<V>'
  'k'             - unsigned integral constant
  'ra','rb'       - distinct modifiable rvalue objects of type 'list<V>&&'
  'n', 'm'        - number of elements in 'a' and 'b', respectively
  'al'            - an STL-style memory allocator
  'i1', 'i2'      - two iterators defining a sequence of 'V' objects
  'v'             - an object of type 'V'
  'rv'            - modifiable rvalue object of type 'V&&'
  'p1', 'p2'      - two iterators belonging to 'a'
  's1', 's2'      - two iterators belonging to 'b'
  'pred'          - a unary predicate
  'binary_pred'   - a binary predicate
  'comp'          - a binary predicate implementing a strict-weak ordering
  'args...'       - a variadic list of (up to 10) arguments
  '{*}'           - C++11-style initializer list of length 'ni'
  distance(i1,i2) - the number of elements in the range '[i1 .. i2)'

  +----------------------------------------------------+--------------------+
  | Operation                                          | Complexity         |
  +====================================================+====================+
  | list<V> a;    (default construction)               | O[1]               |
  | list<V> a(al);                                     |                    |
  +----------------------------------------------------+--------------------+
  | list<V> a(b); (copy construction)                  | O[m]               |
  | list<V> a(b, al);                                  |                    |
  +----------------------------------------------------+--------------------+
  | list<V> a(rb); (move construction)                 | O[1]               |
  | list<V> a(rb, al);                                 | O[1] if 'a' and 'b'|
  |                                                    | use the same       |
  |                                                    | allocator,         |
  |                                                    | O[m]     otherwise |
  +----------------------------------------------------+--------------------+
  | list<V> a(k);                                      | O[k]               |
  | list<V> a(k, v);                                   |                    |
  | list<V> a(k, v, al);                               |                    |
  +----------------------------------------------------+--------------------+
  | list<V> a(i1, i2);                                 | O[distance(i1, i2)]|
  | list<V> a(i1, i2, al);                             |                    |
  +----------------------------------------------------+--------------------+
  | list<V> a({*}, al = A())                           | O[ni]              |
  +----------------------------------------------------+--------------------+
  | a.~list<V>(); (destruction)                        | O[n]               |
  +----------------------------------------------------+--------------------+
  | a = b;                (copy assignment)            | O[max(n, m)]       |
  +----------------------------------------------------+--------------------+
  | a = {*};              (copy assignment)            | O[max(n, ni)]      |
  +----------------------------------------------------+--------------------+
  | a = rb;               (move assignment)            | O[1] if 'a' and 'b'|
  |                                                    | use the same       |
  |                                                    | allocator,         |
  |                                                    | O[max(n, m)]       |
  |                                                    | otherwise          |
  +----------------------------------------------------+--------------------+
  | a.begin(), a.end(), a.cbegin(), a.cend(),          | O[1]               |
  | a.rbegin(), a.rend(), a.crbegin(), a.crend()       |                    |
  +----------------------------------------------------+--------------------+
  | a == b, a != b                                     | O[n]               |
  +----------------------------------------------------+--------------------+
  | a < b, a <= b, a > b, a >= b                       | O[n]               |
  +----------------------------------------------------+--------------------+
  | a.swap(b), swap(a, b)                              | O[1] if 'a' and 'b'|
  |                                                    | use the same       |
  |                                                    | allocator,         |
  |                                                    | O[n + m] otherwise |
  +----------------------------------------------------+--------------------+
  | a.size()                                           | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.max_size()                                       | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.empty()                                          | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.get_allocator()                                  | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.emplace(p1, args...)                             | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.insert(p1, v)                                    | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.insert(p1, k, v)                                 | O[k]               |
  +----------------------------------------------------+--------------------+
  | a.insert(p1, i1, i2)                               | O[distance(i1, i2)]|
  +----------------------------------------------------+--------------------+
  | a.insert(p1, rv)                                   | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.insert(p1, {*})                                  | O[ni]              |
  +----------------------------------------------------+--------------------|
  | a.erase(p1)                                        | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.erase(p1, p2)                                    | O[distance(p1, p2)]|
  +----------------------------------------------------+--------------------+
  | a.clear()                                          | O[n]               |
  +----------------------------------------------------+--------------------+
  | a.assign(i1,i2)                                    | O[distance(i1, i2)]|
  +----------------------------------------------------+--------------------+
  | a.assign(k, v)                                     | O[max(n, k)]       |
  +----------------------------------------------------+--------------------+
  | a.assign({*})                                      | O[max(n, ni)]      |
  +----------------------------------------------------+--------------------+
  | a.front(), a.back()                                | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.emplace_front(args...), a.emplace_back(args...)  | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.push_front(v),                                   |                    |
  | a.push_back(v)                                     | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.push_front(rv),                                  |                    |
  | a.push_back(rv)                                    | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.pop_front(), a.pop_back()                        | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.resize(k), a.resize(k, v)                        | O[k]               |
  +----------------------------------------------------+--------------------+
  | a.splice(p, b),  a.splice(p, b, s1)                | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.splice(p, rb), a.splice(p, rb, s1)               | O[1]               |
  +----------------------------------------------------+--------------------+
  | a.splice(p, b, s1, s2)                             | O[distance(s1, s2)]|
  +----------------------------------------------------+--------------------+
  | a.splice(p, rb, s1, s2)                            | O[distance(s1, s2)]|
  +----------------------------------------------------+--------------------+
  | a.remove(t), a.remove_if(pred)                     | O[n]               |
  +----------------------------------------------------+--------------------+
  | a.unique(), a.unique(binary_pred)                  | O[n]               |
  +----------------------------------------------------+--------------------+
  | a.merge(b),  a.merge(b, comp)                      | O[n]               |
  +----------------------------------------------------+--------------------+
  | a.merge(rb), a.merge(rb, comp)                     | O[n]               |
  +----------------------------------------------------+--------------------+
  | a.sort(), a.sort(comp)                             | O[n*log(n)]        |
  +----------------------------------------------------+--------------------+
  | a.reverse()                                        | O[n]               |
  +----------------------------------------------------+--------------------+
Usage:
This section illustrates intended usage of this component.
Example 1: Filter "Twinkle Star":
Suppose an observatory needs to analyze the results of a sky survey. The raw data is a text file of star observations where each star is represented by a tuple of three numbers: (x, y, b), where x and y represent the angular coordinates of the star in the sky and b represents its brightness on a scale of 0 to 100. A star having brightness 75 or higher is of particular interest, which is called "twinkle star".
Our first example will read such a data file as described above, filter out the dim stars (brightness less than 75), and count the twinkle stars left in the list. Our test data set has been selected such that there are 10 stars in the set, of which 4 are sufficiently bright as to pass our filter.
First, we define the class Star that encapsulates a single tuple, and provides accessors functions x, y, and brightness, file I/O functions read and write, and free operators ==, !=, and <:
  #include <cstdio>
  using namespace std;

  class Star
      // This class represents a star as seen through a digital telescope.
  {
      // DATA
      double d_x, d_y;     // coordinates

      int    d_brightness; // brightness on a scale of 0 to 100

  public:
      // CREATORS
      Star()
          // Create a 'Star' object located at coordinates '(0, 0)' having
          // '0' brightness.
      : d_x(0), d_y(0), d_brightness(0)
      {
      }

      Star(double x, double y, int b)
          // Create a 'Star' object located at the specified coordinates
          // '(x, y)' having the specified 'b' brightness.
      : d_x(x), d_y(y), d_brightness(b)
      {
      }

      // Compiler-generated copy construction, assignment, and destructor
      // Star(const Star&) = default;
      // Star& operator=(const Star&) = default;
      // ~Star() = default;

      // MANIPULATORS
      bool read(FILE *input);
          // Read x, y, and brightness from the specified 'input' file.
          // Return 'true' if the read succeeded and 'false' otherwise.

      void write(FILE *output) const;
          // Write x, y, and brightness to the specified 'output' file
          // followed by a newline.

      // ACCESSORS
      double x() const
          // Return the x coordinate of this 'Star' object.
      {
          return d_x;
      }

      double y() const
          // Return the y coordinate of this 'Star' object.
      {
          return d_y;
      }

      int brightness() const
          // Return the brightness of this 'Star' object.
      {
          return d_brightness;
      }
  };

  // FREE FUNCTIONS
  bool operator==(const Star& lhs, const Star& rhs);
  bool operator!=(const Star& lhs, const Star& rhs);
  bool operator< (const Star& lhs, const Star& rhs);
Then, we define a readData method that reads a file of data points and appends each onto a list. The stars are stored in the data file in ascending sorted order by x and y coordinates.
  void readData(list<Star> *starList, FILE *input)
  {
      Star s;
      while (s.read(input)) {
          starList->push_back(s);
      }
  }
Now, we define the filter method, which is responsible for removing stars with a brightness of less than 75 from the data set. It does this by iterating over the list and erasing any element that does not pass the filter. The list object features a fast erase member function. The return value of erase is an iterator to the element immediately following the erased element:
  void filter(list<Star> *starList)
  {
      static const int threshold = 75;

      list<Star>::iterator i = starList->begin();
      while (i != starList->end()) {
          if (i->brightness() < threshold) {
              i = starList->erase(i);  // Erase and advance to next element.
          }
          else {
              ++i;  // Advance to next element without erasing
          }
      }
  }
Finally, we use the methods defined in above steps to put together our program to find twinkle stars:
  int usageExample1(int verbose)
  {
      FILE *input = fopen("star_data1.txt", "r");  // Open input file.
      assert(input);

      list<Star> starList;                         // Define a list of stars.
      assert(starList.empty());                    // A list should be empty
                                                   // after default
                                                   // construction.

      readData(&starList, input);                  // Read input to the list.
      assert(10 == starList.size());               // Verify correct reading.
      fclose(input);                               // Close input file.

      filter(&starList);                           // Pick twinkle stars.
      assert(4 == starList.size());                // Verify correct filter.

      // Print out twinkle stars.
      if (verbose) {
          for (list<Star>::const_iterator i = starList.begin();
               i != starList.end(); ++i) {
              i->write(stdout);
          }
      }
      return 0;
  }
Example 2: Combine Two Star Surveys:
In the second example, we want to combine the results from two star surveys into a single list, using the same Star class defined in the first usage example.
First, we begin by reading both lists and filtering them. (Our test data is selected so that the second data file contains 8 stars of which 3 are sufficiently bright as to pass our filter:
  int usageExample2(int verbose)
  {
      FILE *input = fopen("star_data1.txt", "r");  // Open first input file.
      assert(input);

      list<Star> starList1;                        // Define first star list.
      assert(starList1.empty());

      readData(&starList1, input);                 // Read input into list.
      assert(10 == starList1.size());
      fclose(input);                               // Close first input file.

      input = fopen("star_data2.txt", "r");        // Open second input file.
      assert(input);

      list<Star> starList2;                        // Define second list.
      assert(starList2.empty());

      readData(&starList2, input);                 // Read input into list.
      assert(8 == starList2.size());
      fclose(input);                               // Close input file.

      filter(&starList1);                          // Pick twinkle stars from
                                                   // the first star list.
      assert(4 == starList1.size());

      filter(&starList2);                          // Pick twinkle stars from
                                                   // the second star list.
      assert(3 == starList2.size());
Then, we combine the two lists, starList1 and starList2. One way to do this is to simply insert the second list at the end of the first:
      list<Star> tmp1(starList1);  // Make a copy of the first list
      list<Star> tmp2(starList2);  // Make a copy of the second list
      tmp1.insert(tmp1.end(), tmp2.begin(), tmp2.end());
      assert(7 == tmp1.size());    // Verify combined size.
      assert(3 == tmp2.size());    // 'tmp2' should be unchanged.
Next, let's have a closer look of the above code and see if we can improve the combination performance. The above insert method appends a copy of each element in tmp2 onto the end of tmp1. This copy is unnecessary because we have no need for tmp2 after the lists have been combined. A faster and less-memory-intensive technique is to use the splice function, which moves rather than copies elements from one list to another:
      tmp1 = starList1;
      tmp2 = starList2;
      tmp1.splice(tmp1.begin(), tmp2);
      assert(7 == tmp1.size());    // Verify combined size.
      assert(0 == tmp2.size());    // 'tmp2' should be emptied by the splice.
Notice that, while the original lists were sorted in ascending order (because the data files were originally sorted), the combined list is no longer sorted. To fix it, we sort tmp1 using the sort member function:
      tmp1.sort();
Then, we suggest a third, and also the best approach to combine two lists, which is to take advantage of the fact that the lists were originally sorted, using the merge function:
      starList1.merge(starList2);     // Merge 'starList2' into 'starList1'.
      assert(7 == starList1.size());  // Verify combined size.
      assert(0 == starList2.size());  // starList2 should be emptied by the
                                      // merge.
Now, since the two star surveys may overlap, we want to eliminate duplicates. We accomplish this by using the unique member function:
      starList1.unique();             // Eliminate duplicates in 'starList1'.
      assert(6 == starList1.size());  // Verify size after elimination.
Finally, we print the result:
      if (verbose) {
          for (list<Star>::const_iterator i = starList1.begin();
               i != starList1.end(); ++i) {
              i->write(stdout);
          }
      }
      return 0;
  }
For completeness, the implementations of the read, write, and comparison functions for class Star are shown below:
  bool Star::read(FILE *input)
  {
      int ret = fscanf(input, "%lf %lf %d", &d_x, &d_y, &d_brightness);
      return 3 == ret;
  }

  void Star::write(FILE *output) const
  {
      fprintf(output, "%f %f %d\n", d_x, d_y, d_brightness);
  }

  bool operator==(const Star& lhs, const Star& rhs)
  {
      return lhs.x() == rhs.x()
          && lhs.y() == rhs.y()
          && lhs.brightness() == rhs.brightness();
  }

  bool operator!=(const Star& lhs, const Star& rhs)
  {
      return ! (lhs == rhs);
  }

  bool operator<(const Star& lhs, const Star& rhs)
  {
      if (lhs.x() < rhs.x())
          return true;
      else if (rhs.x() < lhs.x())
          return false;
      else if (lhs.y() < rhs.y())
          return true;
      else if (rhs.y() < lhs.y())
          return true;
      else
          return lhs.brightness() < rhs.brightness();
  }

Typedef Documentation

template<class VALUE>
typedef std::bidirectional_iterator_tag bsl::List_Iterator< VALUE >::iterator_category [inherited]
template<class VALUE>
typedef NcType bsl::List_Iterator< VALUE >::value_type [inherited]
template<class VALUE>
typedef BloombergLP::bsls::Types::IntPtr bsl::List_Iterator< VALUE >::difference_type [inherited]
template<class VALUE>
typedef VALUE* bsl::List_Iterator< VALUE >::pointer [inherited]
template<class VALUE>
typedef VALUE& bsl::List_Iterator< VALUE >::reference [inherited]
template<class VALUE , class ALLOCATOR >
typedef AllocTraits::pointer bsl::List_NodeProctor< VALUE, ALLOCATOR >::NodePtr [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef VALUE& bsl::list< VALUE, ALLOCATOR >::reference [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef const VALUE& bsl::list< VALUE, ALLOCATOR >::const_reference [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef List_Iterator<VALUE> bsl::list< VALUE, ALLOCATOR >::iterator [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef List_Iterator<const VALUE> bsl::list< VALUE, ALLOCATOR >::const_iterator [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef allocator_traits<ALLOCATOR>::pointer bsl::list< VALUE, ALLOCATOR >::pointer [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef allocator_traits<ALLOCATOR>::const_pointer bsl::list< VALUE, ALLOCATOR >::const_pointer [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef allocator_traits<ALLOCATOR>::size_type bsl::list< VALUE, ALLOCATOR >::size_type [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef allocator_traits<ALLOCATOR>::difference_type bsl::list< VALUE, ALLOCATOR >::difference_type [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef VALUE bsl::list< VALUE, ALLOCATOR >::value_type [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef ALLOCATOR bsl::list< VALUE, ALLOCATOR >::allocator_type [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef bsl::reverse_iterator<iterator> bsl::list< VALUE, ALLOCATOR >::reverse_iterator [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
typedef bsl::reverse_iterator<const_iterator> bsl::list< VALUE, ALLOCATOR >::const_reverse_iterator [inherited]

Function Documentation

template<class VALUE>
bsl::List_Iterator< VALUE >::List_Iterator (  )  [inherited]

Create a singular iterator (i.e., one that cannot be incremented, decremented, or dereferenced until assigned a non-singular value).

template<class VALUE>
bsl::List_Iterator< VALUE >::List_Iterator ( Node nodePtr  )  [explicit, inherited]

Create an iterator that references the value pointed to by the specified nodePtr. If 0 == nodePtr the iterator will be singular.

template<class VALUE>
bsl::List_Iterator< VALUE >::List_Iterator ( const NcIter other  )  [inherited]

IMPLICIT: Create an iterator that has the same value as the specified other iterator. If the (template parameter) type VALUE is not const-qualified, then this constructor is the copy constructor; otherwise, the copy constructor is implicitly generated. Note that this method is marked "IMPLICIT" in case it is not the copy constructor.

Note that this means that a List_Iterator<const VALUE> can be copy constructed or assigned to from a List_Iterator<VALUE>, but not vice-versa.

template<class VALUE>
List_Iterator& bsl::List_Iterator< VALUE >::operator++ (  )  [inherited]

Advance this iterator to the next element in the list and return its new value. The behavior is undefined unless this iterator is in the range [begin() .. end()) for some list (i.e., the iterator is not singular, is not end(), and has not been invalidated).

template<class VALUE>
List_Iterator& bsl::List_Iterator< VALUE >::operator-- (  )  [inherited]

Regress this iterator to the previous element in the list and return its new value. The behavior is undefined unless this iterator is in the range (begin() .. end()] for some list (i.e., the iterator is not singular, is not begin(), and has not been invalidated).

template<class VALUE>
List_Iterator bsl::List_Iterator< VALUE >::operator++ ( int   )  [inherited]

Advance this iterator to the next element in the list and return its previous value. The behavior is undefined unless this iterator is in the range [begin() .. end()) for some list (i.e., the iterator is not singular, is not end(), and has not been invalidated).

template<class VALUE>
List_Iterator bsl::List_Iterator< VALUE >::operator-- ( int   )  [inherited]

Regress this iterator to the previous element in the list and return its previous value. The behavior is undefined unless this iterator is in the range (begin() .. end()] for some list (i.e., the iterator is not singular, is not begin(), and has not been invalidated).

template<class VALUE>
reference bsl::List_Iterator< VALUE >::operator* (  )  const [inherited]

Return a reference providing modifiable access to the element referenced by this iterator. The behavior is undefined unless this iterator is in the range [begin() .. end()) for some list (i.e., the iterator is not singular, is not end(), and has not been invalidated).

template<class VALUE>
pointer bsl::List_Iterator< VALUE >::operator-> (  )  const [inherited]

Return a pointer providing modifiable access to the element referenced by this iterator. The behavior is undefined unless this iterator is in the range [begin() .. end()) for some list (i.e., the iterator is not singular, is not end(), and has not been invalidated).

template<class T1 , class T2 >
bool bsl::operator== ( List_Iterator< T1 >  lhs,
List_Iterator< T2 >  rhs 
)

Return true if the specified lhs and rhs iterators have the same value, and false otherwise. Two iterators have the same value if both refer to the same element of the same list or both are the end() iterator of the same list. The behavior is undefined unless both lhs and rhs refer to the same list. Note that the different types T1 and T2 are to facilitate comparisons between const and non-'const' iterators and there will be a compilation error if T1 and T2 differ in any way other than const-ness.

template<class T1 , class T2 >
bool bsl::operator!= ( List_Iterator< T1 >  lhs,
List_Iterator< T2 >  rhs 
)

Return true if the specified lhs and rhs iterators do not have the same value, and false otherwise. Two iterators do not have the same value unless both refer to the same element of the same list or unless both are the end() iterator of the same list. The behavior is undefined unless both lhs and rhs refer to the same list. Note that the different types T1 and T2 are to facilitate comparisons between const and non-'const' iterators and there will be a compilation error if T1 and T2 differ in any way other than const-ness.

template<class VALUE, class ALLOCATOR>
bsl::List_AllocAndSizeWrapper< VALUE, ALLOCATOR >::List_AllocAndSizeWrapper ( const NodeAlloc &  basicAllocator,
size_type  size 
) [inherited]

Create an allocator and size wrapper having the specified basicAllocator and (initial) size.

template<class VALUE, class ALLOCATOR>
size_type& bsl::List_AllocAndSizeWrapper< VALUE, ALLOCATOR >::size (  )  [inherited]

Return a reference providing modifiable access to the size field of this object.

template<class VALUE, class ALLOCATOR>
const size_type& bsl::List_AllocAndSizeWrapper< VALUE, ALLOCATOR >::size (  )  const [inherited]

Return a reference providing non-modifiable access to the size field of this object.

template<class VALUE , class ALLOCATOR >
bsl::List_NodeProctor< VALUE, ALLOCATOR >::List_NodeProctor ( list< VALUE, ALLOCATOR > *  listPtr,
NodePtr  nodePtr 
) [inherited]

Create a node proctor object that will use the specified list listPtr to free the specified nodePtr. The behavior is undefined unless nodePtr was allocated by the allocator of *listPtr.

template<class VALUE , class ALLOCATOR >
bsl::List_NodeProctor< VALUE, ALLOCATOR >::~List_NodeProctor (  )  [inherited]

Destroy this node proctor, and free the node it contains unless the release method has been called before. Note that the d_value field of the node is not destroyed.

template<class VALUE , class ALLOCATOR >
void bsl::List_NodeProctor< VALUE, ALLOCATOR >::release (  )  [inherited]

Detach the node contained in this proctor from the proctor. After calling this release method, the proctor no longer frees any node upon its destruction.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
bsl::list< VALUE, ALLOCATOR >::list (  )  [inherited]

Create an empty list. A default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator, the currently installed default allocator is used.

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

Create an empty list. Use the specified basicAllocator to supply memory. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator shall be convertible to bslma::Allocator *.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
bsl::list< VALUE, ALLOCATOR >::list ( size_type  numElements  )  [explicit, inherited]

Create a list of the specified numElements size whose every element is default-constructed. A default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator, the currently installed default allocator is used. Throw bsl::length_error if numElements > max_size(). This method requires that the (template parameter) VALUE be default-insertable into this list (see Requirements on VALUE).

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

Create a list of the specified numElements size whose every element is default-constructed. Use the specified basicAllocator to supply memory. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator shall be convertible to bslma::Allocator *. Throw bsl::length_error if numElements > max_size(). This method requires that the (template parameter) VALUE be default-insertable into this list (see Requirements on VALUE).

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

Create a list 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 be copy-insertable into this list (see Requirements on VALUE).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class INPUT_ITERATOR >
bsl::list< VALUE, ALLOCATOR >::list ( INPUT_ITERATOR  first,
INPUT_ITERATOR  last,
const ALLOCATOR &  basicAllocator = ALLOCATOR(),
typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type = 0 
) [inline, inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
bsl::list< VALUE, ALLOCATOR >::list ( const list< VALUE, ALLOCATOR > &  original  )  [inherited]

Create a list having 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 allocate memory. This method requires that the (template parameter) type VALUE be copy-insertable into this list (see Requirements on VALUE).

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

Create a list that has the same value as the specified original object. Use the specified basicAllocator to supply memory. This method requires that the (template parameter) VALUE be copy-insertable into this list (see Requirements on VALUE). Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) type ALLOCATOR is bsl::allocator (the default).

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

IMPLICIT: Create a list having the same value as the specified original object by moving (in constant time) the contents of original to the new list. The allocator associated with original is propagated for use in the newly-created list. original is left in a valid but unspecified state.

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

Create a list 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 list 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 be move-insertable into this list (see Requirements on VALUE). Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) ALLOCATOR is bsl::allocator (the default).

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

IMPLICIT: Create a list 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 be copy-insertable into this list (see Requirements on VALUE).

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

Destroy this list by calling the destructor for each element and deallocating all allocated storage.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
list& bsl::list< VALUE, ALLOCATOR >::operator= ( const list< VALUE, 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) type VALUE be copy-assignable and copy-insertable into this list. Note that, to the extent possible, existing elements of this list are copy-assigned to, to minimize the number of nodes that need to be copy-inserted or erased.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
list& operator= (BloombergLP::bslmf::MovableRef<list> rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION( AllocTraits list& bsl::list< VALUE, ALLOCATOR >::operator= ( std::initializer_list< value_type 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_move_assignment, and return a reference providing modifiable access to this object. The contents of rhs are moved (in constant time) to this list if get_allocator() == rhs.get_allocator() (after accounting for the aforementioned trait); otherwise, all elements in this list are either destroyed or move-assigned to and each additional element in rhs is move-inserted into this list. 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) type VALUE be move-assignable and move-insertable into this list (see Requirements on VALUE). Assign to this list, in order, the sequence of values in the specified rhs initializer list, and return a reference providing modifiable access to this list. This method requires that the (template parameter) type VALUE be copy-assignable and copy-insertable into this list. Note that, to the extent possible, existing elements of this list are copy-assigned to, to minimize the number of nodes that need to be copy-inserted or erased.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class INPUT_ITERATOR >
void bsl::list< VALUE, ALLOCATOR >::assign ( INPUT_ITERATOR  first,
INPUT_ITERATOR  last,
typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type = 0 
) [inline, inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::assign ( size_type  numElements,
const value_type value 
) [inherited]

Replace the contents of this list with the specified numElements copies of the specified value. Note that, to the extent possible, existing elements of this list are copy-assigned to, to minimize the number of nodes that need to be copy-inserted or erased.

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

Assign to this list, in order, the sequence of values in the specified values initializer list. This method requires that the (template parameter) type VALUE be copy-assignable and copy-insertable into this list. Note that, to the extent possible, existing elements of this list are copy-assigned to, to minimize the number of nodes that need to be copy-inserted or erased.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
iterator bsl::list< VALUE, ALLOCATOR >::begin (  )  [inherited]

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
iterator bsl::list< VALUE, ALLOCATOR >::end (  )  [inherited]

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
reverse_iterator bsl::list< VALUE, ALLOCATOR >::rbegin (  )  [inherited]

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
reverse_iterator bsl::list< VALUE, ALLOCATOR >::rend (  )  [inherited]

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::clear (  )  [inherited]

Remove all the elements from this list.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::resize ( size_type  newSize  )  [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::resize ( size_type  newSize,
const value_type value 
) [inherited]

Change the size of this list 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, default-constructed objects of the (template parameter) VALUE are emplaced. This method has no effect if newSize == size(). Throw bsl::length_error if newSize > max_size().

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
reference bsl::list< VALUE, ALLOCATOR >::back (  )  [inherited]

Return a reference providing modifiable access to the last element of this list. The behavior is undefined unless this list contains at least one element.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
reference bsl::list< VALUE, ALLOCATOR >::front (  )  [inherited]

Return a reference providing modifiable access to the first element of this list. The behavior is undefined unless this list contains at least one element.

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

Remove and destroy the last element of this list. The behavior is undefined unless this list contains at least one element.

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

Remove and destroy the first element of this list. The behavior is undefined unless this list contains at least one element.

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

Remove from this list the element at the specified position, and return an iterator providing modifiable access to the element immediately following the removed element, or to the position returned by the end method if the removed element was the last in the sequence. The behavior is undefined unless position refers to an element in this list.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
iterator bsl::list< VALUE, ALLOCATOR >::erase ( const_iterator  dstBegin,
const_iterator  dstEnd 
) [inherited]

Remove from this list the elements starting at the specified dstBegin position up to, but not including, the specified dstEnd position, and return a non-'const' iterator equivalent to dstEnd. The behavior is undefined unless dstBegin is an iterator in the range [begin() .. end()] and dstEnd is an iterator in the range [dstBegin .. end()] (both endpoints included). Note that dstBegin may be equal to dstEnd, in which case the list is not modified.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
reference bsl::list< VALUE, ALLOCATOR >::emplace_back ( ARGS &&...  arguments  )  [inherited]

Append to the back of this list 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 be move-insertable into this list and emplace-constructible from arguments (see Requirements on VALUE).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
reference bsl::list< VALUE, ALLOCATOR >::emplace_front ( ARGS &&...  arguments  )  [inherited]

Prepend to the front of this list 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 be move-insertable into this list and emplace-constructible from arguments (see Requirements on VALUE).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::push_back ( const value_type value  )  [inherited]

Append to the back of this list 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 be copy-constructible (see Requirements on VALUE).

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

Append to the back of this list 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 be move-insertable into this list (see Requirements on VALUE).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::push_front ( const value_type value  )  [inherited]

Prepend to the front of this list 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 be copy-constructible (see Requirements on VALUE).

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

Prepend to the front of this list 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 be move-insertable into this list (see Requirements on VALUE).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
iterator bsl::list< VALUE, ALLOCATOR >::emplace ( const_iterator  position,
ARGS &&...  arguments 
) [inherited]

Insert at the specified position in this list 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 be move-insertable into this list and emplace-constructible from arguments (see Requirements on VALUE). The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()] (both endpoints included).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
const value_type value 
) [inherited]

Insert at the specified dstPosition in this list 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 copy constructor or assignment operator. This method requires that the (template parameter) VALUE be copy-insertable into this list (see Requirements on VALUE). The behavior is undefined unless dstPosition is an iterator in the range [cbegin() .. cend()] (both endpoints included).

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
BloombergLP::bslmf::MovableRef< value_type value 
) [inherited]

Insert at the specified dstPosition in this list 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 be move-insertable into this list (see Requirements on VALUE). The behavior is undefined unless dstPosition is an iterator in the range [cbegin() .. cend()] (both endpoints included).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
size_type  numElements,
const value_type value 
) [inherited]

Insert at the specified dstPosition in this list 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 requires that the (template parameter) VALUE be copy-insertable into this list (see Requirements on VALUE). The behavior is undefined unless dstPosition is an iterator in the range [cbegin() .. cend()] (both endpoints included).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class INPUT_ITERATOR >
iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
INPUT_ITERATOR  first,
INPUT_ITERATOR  last,
typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type = 0 
) [inline, inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
std::initializer_list< value_type values 
) [inherited]

Insert at the specified dstPosition in this list 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 requires that the (template parameter) VALUE be copy-insertable into this list (see Requirements on VALUE). The behavior is undefined unless dstPosition is an iterator in the range [cbegin() .. cend()] (both endpoints included).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::merge ( list< VALUE, ALLOCATOR > &  other  )  [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::merge ( BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  other  )  [inherited]

Merge the specified sorted other list into this sorted list. This method has no effect if other is this list; otherwise, other is left empty. The behavior is undefined unless both other and this list are sorted in non-decreasing order according to the ordering provided by operator<, and unless both other and this list use the same allocator. operator< must define a strict weak ordering per value_type (see Comparators and Strict Weak Ordering).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class COMPARE >
void bsl::list< VALUE, ALLOCATOR >::merge ( list< VALUE, ALLOCATOR > &  other,
COMPARE  comparator 
) [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class COMPARE >
void bsl::list< VALUE, ALLOCATOR >::merge ( BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  other,
COMPARE  comparator 
) [inherited]

Merge the specified sorted other list into this sorted list, using the specified binary comparator predicate to order elements. This method has no effect if other is this list; otherwise, other is left empty. The behavior is undefined unless both other and this list are sorted in non-decreasing order according to the ordering provided by comparator, and unless both other and this list use the same allocator.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::remove ( const value_type value  )  [inherited]

Erase all the elements having the specified value from this list.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class PREDICATE >
void bsl::list< VALUE, ALLOCATOR >::remove_if ( PREDICATE  predicate  )  [inherited]

Remove and destroy all elements in this list for which the specified unary predicate returns true.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::reverse (  )  [inherited]

Reverse the order of the elements in this list.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::sort (  )  [inherited]

Sort this list in non-decreasing order according to the order provided by operator<. operator< must provide a strict weak ordering over value_type (see Comparators and Strict Weak Ordering). The sort is stable, meaning that if !(a < b) && !(b < a), then the ordering of elements a and b in the sequence is preserved.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class COMPARE >
void bsl::list< VALUE, ALLOCATOR >::sort ( COMPARE  comparator  )  [inherited]

Sort this list in non-decreasing order according to the order provided by the specified comparator predicate. comparator must define a strict weak ordering over value_type (see Comparators and Strict Weak Ordering). The sort is stable, meaning that if !comparator(a, b) && !comparator(b, a), then the ordering of elements a and b in the sequence is preserved.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
list< VALUE, ALLOCATOR > &  src 
) [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  src 
) [inherited]

Remove all elements of the specified src list and insert them, in the same order, in this list at the specified dstPosition. The behavior is undefined unless src is not this list, this list and src use the same allocator, and dstPosition is in the range [begin() .. end()] (note both endpoints included).

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
list< VALUE, ALLOCATOR > &  src,
const_iterator  srcNode 
) [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  src,
const_iterator  srcNode 
) [inherited]

Remove the single element at the specified srcNode from the specified src list, and insert it at the specified dstPosition in this list. The behavior is undefined unless srcNode refers to a valid element in src, this list and src use the same allocator, and dstPosition is in the range [begin() .. end()] (note both endpoints included). Note that src and *this may be the same list, in which case the element is moved to a (possibly) new position in the list.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
list< VALUE, ALLOCATOR > &  src,
const_iterator  first,
const_iterator  last 
) [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  src,
const_iterator  first,
const_iterator  last 
) [inherited]

Remove the elements in the specified range [first .. last) from the specified src list, and insert them, in the same order, at the specified dstPosition in this list. The behavior is undefined unless [first .. last) represents a range of valid elements in src, dstPosition is not in the range [first .. last), this list and src use the same allocator, and dstPosition is in the range [begin() .. end()] (note both endpoints included). Note that src and *this may be the same list, in which case an entire sequence of nodes is moved to a (possibly) new position in this list.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void bsl::list< VALUE, ALLOCATOR >::unique (  )  [inherited]

Erase from this list all but the first element of every consecutive group of elements that have the same value.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
template<class EQ_PREDICATE >
void bsl::list< VALUE, ALLOCATOR >::unique ( EQ_PREDICATE  binaryPredicate  )  [inherited]

Erase from this list all but the first element of every consecutive group of elements for which the specified binaryPredicate returns true for any two consecutive elements in the group.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_iterator bsl::list< VALUE, ALLOCATOR >::cbegin (  )  const [inherited]

Return an iterator providing non-modifiable access to the first value_type object in the ordered sequence of value_type objects maintained by this list, or the end iterator if this list is empty.

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_iterator bsl::list< VALUE, ALLOCATOR >::end (  )  const [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_iterator bsl::list< VALUE, ALLOCATOR >::cend (  )  const [inherited]

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_reverse_iterator bsl::list< VALUE, ALLOCATOR >::rbegin (  )  const [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_reverse_iterator bsl::list< VALUE, ALLOCATOR >::crbegin (  )  const [inherited]

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_reverse_iterator bsl::list< VALUE, ALLOCATOR >::rend (  )  const [inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_reverse_iterator bsl::list< VALUE, ALLOCATOR >::crend (  )  const [inherited]

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

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
bool bsl::list< VALUE, ALLOCATOR >::empty (  )  const [inherited]

Return true if this list has no elements, and false otherwise.

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

Return an upper bound on the largest number of elements that this list could possibly hold. Note that the return value of this function does not guarantee that this list can successfully grow that large, or even close to that large without running out of resources.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
size_type bsl::list< VALUE, ALLOCATOR >::size (  )  const [inherited]

Return the number of elements in this list.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_reference bsl::list< VALUE, ALLOCATOR >::back (  )  const [inherited]

Return a reference providing non-modifiable access to the last element of this list. The behavior is undefined unless this list contains at least one element.

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
const_reference bsl::list< VALUE, ALLOCATOR >::front (  )  const [inherited]

Return a reference providing non-modifiable access to the first element of this list. The behavior is undefined unless this list contains at least one element.

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

Return a copy of the allocator used for memory allocation by this list.

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

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two list 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 be equality-comparable (see Requirements on VALUE).

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

Return true if the value of the specified lhs list is lexicographically less than that of the specified rhs list, and false otherwise. Given iterators i and j over the respective sequences [lhs.begin() .. lhs.end()) and [rhs.begin() .. rhs.end()), the value of list lhs is lexicographically less than that of list 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 , class ALLOCATOR >
bool bsl::operator> ( const list< VALUE, ALLOCATOR > &  lhs,
const list< VALUE, ALLOCATOR > &  rhs 
)

Return true if the value of the specified lhs list is lexicographically greater than that of the specified rhs list, and false otherwise. The value of list lhs is lexicographically greater than that of list 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 , class ALLOCATOR >
bool bsl::operator<= ( const list< VALUE, ALLOCATOR > &  lhs,
const list< VALUE, ALLOCATOR > &  rhs 
)

Return true if the value of the specified lhs list is lexicographically less than or equal to that of the specified rhs list, and false otherwise. The value of list lhs is lexicographically less than or equal to that of list 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 , class ALLOCATOR >
bool bsl::operator>= ( const list< VALUE, ALLOCATOR > &  lhs,
const list< VALUE, ALLOCATOR > &  rhs 
)

Return true if the value of the specified lhs list is lexicographically greater than or equal to that of the specified rhs list, and false otherwise. The value of list lhs is lexicographically greater than or equal to that of list 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 , class ALLOCATOR , class BDE_OTHER_TYPE >
list<VALUE, ALLOCATOR>::size_type bsl::erase ( list< VALUE, ALLOCATOR > &  l,
const BDE_OTHER_TYPE &  value 
)

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

template<class VALUE , class ALLOCATOR , class PREDICATE >
list<VALUE, ALLOCATOR>::size_type bsl::erase_if ( list< VALUE, ALLOCATOR > &  l,
PREDICATE  predicate 
)

Erase all the elements in the specified list l that satisfy the specified predicate predicate. Return the number of elements erased.

template<class VALUE , class ALLOCATOR >
void bsl::swap ( list< VALUE, ALLOCATOR > &  a,
list< VALUE, 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.


Variable Documentation

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
void swap (list& other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION( AllocTraits const_iterator bsl::list< VALUE, ALLOCATOR >::begin() const 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.


Friends

template<class VALUE >
friend class list [friend, inherited]
template<class VALUE >
friend class List_Iterator [friend, inherited]
template<class VALUE>
friend class list [friend, inherited]
template<class VALUE>
friend class List_Iterator [friend, inherited]
template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
friend class List_NodeProctor< VALUE, ALLOCATOR > [friend, inherited]
template<class VALUE>
template<class T1 , class T2 >
bool operator== ( List_Iterator< T1 >  ,
List_Iterator< T2 >   
) [friend, inherited]

Return true if the specified lhs and rhs iterators have the same value, and false otherwise. Two iterators have the same value if both refer to the same element of the same list or both are the end() iterator of the same list. The behavior is undefined unless both lhs and rhs refer to the same list. Note that the different types T1 and T2 are to facilitate comparisons between const and non-'const' iterators and there will be a compilation error if T1 and T2 differ in any way other than const-ness.