From 08c1e93fa36a49f49325a07fe91ff92c964c2b6c Mon Sep 17 00:00:00 2001 From: Chanho Park Date: Thu, 11 Dec 2014 18:55:56 +0900 Subject: Imported Upstream version 1.57.0 --- doc/html/boost/container/list.html | 685 +++++++++++++++++++++++-------------- 1 file changed, 422 insertions(+), 263 deletions(-) (limited to 'doc/html/boost/container/list.html') diff --git a/doc/html/boost/container/list.html b/doc/html/boost/container/list.html index 75f7262a04..750fa90b5b 100644 --- a/doc/html/boost/container/list.html +++ b/doc/html/boost/container/list.html @@ -3,7 +3,7 @@ Class template list - + @@ -31,193 +31,230 @@

Synopsis

// In header: <boost/container/list.hpp>
 
-template<typename T, typename A = std::allocator<T> > 
+template<typename T, typename Allocator = std::allocator<T> > 
 class list {
 public:
-  // types
-  typedef T                                       value_type;            
-  typedef allocator_traits_type::pointer          pointer;                 // Pointer to T. 
-  typedef allocator_traits_type::const_pointer    const_pointer;           // Const pointer to T. 
-  typedef allocator_traits_type::reference        reference;               // Reference to T. 
-  typedef allocator_traits_type::const_reference  const_reference;         // Const reference to T. 
-  typedef allocator_traits_type::size_type        size_type;               // An unsigned integral type. 
-  typedef allocator_traits_type::difference_type  difference_type;         // A signed integral type. 
-  typedef A                                       allocator_type;          // The allocator type. 
-  typedef NodeAlloc                               stored_allocator_type;   // Non-standard extension: the stored allocator type. 
-  typedef std::reverse_iterator< const_iterator > const_reverse_iterator;
+  // types
+  typedef T                                                                  value_type;            
+  typedef ::boost::container::allocator_traits< Allocator >::pointer         pointer;               
+  typedef ::boost::container::allocator_traits< Allocator >::const_pointer   const_pointer;         
+  typedef ::boost::container::allocator_traits< Allocator >::reference       reference;             
+  typedef ::boost::container::allocator_traits< Allocator >::const_reference const_reference;       
+  typedef ::boost::container::allocator_traits< Allocator >::size_type       size_type;             
+  typedef ::boost::container::allocator_traits< Allocator >::difference_type difference_type;       
+  typedef Allocator                                                          allocator_type;        
+  typedef implementation_defined                                             stored_allocator_type; 
+  typedef implementation_defined                                             iterator;              
+  typedef implementation_defined                                             const_iterator;        
+  typedef implementation_defined                                             reverse_iterator;      
+  typedef implementation_defined                                             const_reverse_iterator;
 
   // construct/copy/destruct
-  list();
-  explicit list(const allocator_type &);
-  explicit list(size_type);
-  list(size_type, const T &, const A & = A());
-  list(const list &);
-  list(list &&);
-  list(const list &, const allocator_type &);
-  list(list &&, const allocator_type &);
-  template<typename InpIt> list(InpIt, InpIt, const A & = A());
-  list& operator=(const ThisType &);
-  list& operator=(ThisType &&);
-  ~list();
+  list();
+  explicit list(const allocator_type &) noexcept;
+  explicit list(size_type);
+  list(size_type, const T &, const Allocator & = Allocator());
+  list(const list &);
+  list(list &&);
+  list(const list &, const allocator_type &);
+  list(list &&, const allocator_type &);
+  template<typename InpIt> list(InpIt, InpIt, const Allocator & = Allocator());
+  list(std::initializer_list< value_type >, const Allocator & = Allocator());
+  list & operator=(const list &);
+  list & operator=(list &&) noexcept(allocator_traits_type::propagate_on_container_move_assignment::value));
+  list & operator=(std::initializer_list< value_type >);
+  ~list();
 
-  // public member functions
-  allocator_type get_allocator() const;
-  const stored_allocator_type & get_stored_allocator() const;
-  stored_allocator_type & get_stored_allocator();
-  void clear();
-  iterator begin();
-  const_iterator begin() const;
-  iterator end();
-  const_iterator end() const;
-  reverse_iterator rbegin();
-  const_reverse_iterator rbegin() const;
-  reverse_iterator rend();
-  const_reverse_iterator rend() const;
-  const_iterator cbegin() const;
-  const_iterator cend() const;
-  const_reverse_iterator crbegin() const;
-  const_reverse_iterator crend() const;
-  bool empty() const;
-  size_type size() const;
-  size_type max_size() const;
-  void push_front(const T &);
-  void push_front(T &&);
-  void push_back(const T &);
-  void push_back(T &&);
-  void pop_front();
-  void pop_back();
-  reference front();
-  const_reference front() const;
-  reference back();
-  const_reference back() const;
-  void resize(size_type, const T &);
-  void resize(size_type);
-  void swap(ThisType &);
-  void insert(const_iterator, size_type, const T &);
-  template<typename InpIt> void insert(const_iterator, InpIt, InpIt);
-  iterator insert(const_iterator, const T &);
-  iterator insert(const_iterator, T &&);
-  template<class... Args> void emplace_back(Args &&...);
-  template<class... Args> void emplace_front(Args &&...);
-  template<class... Args> iterator emplace(const_iterator, Args &&...);
-  iterator erase(const_iterator);
-  iterator erase(const_iterator, const_iterator);
-  void assign(size_type, const T &);
-  template<typename InpIt> void assign(InpIt, InpIt);
-  void splice(const_iterator, ThisType &);
-  void splice(const_iterator, ThisType &, const_iterator);
-  void splice(const_iterator, ThisType &, const_iterator, const_iterator);
-  void splice(const_iterator, ThisType &, const_iterator, const_iterator, 
-              size_type);
-  void reverse();
-  void remove(const T &);
-  template<typename Pred> void remove_if(Pred);
-  void unique();
-  template<typename BinaryPredicate> void unique(BinaryPredicate);
-  void merge(list< T, A > &);
-  template<typename StrictWeakOrdering> void merge(list &, StrictWeakOrdering);
-  void sort();
-  template<typename StrictWeakOrdering> void sort(StrictWeakOrdering);
+  // public member functions
+  void assign(size_type, const T &);
+  template<typename InpIt> void assign(InpIt, InpIt);
+  void assign(std::initializer_list< value_type >);
+  allocator_type get_allocator() const noexcept;
+  stored_allocator_type & get_stored_allocator() noexcept;
+  const stored_allocator_type & get_stored_allocator() const noexcept;
+  iterator begin() noexcept;
+  const_iterator begin() const noexcept;
+  iterator end() noexcept;
+  const_iterator end() const noexcept;
+  reverse_iterator rbegin() noexcept;
+  const_reverse_iterator rbegin() const noexcept;
+  reverse_iterator rend() noexcept;
+  const_reverse_iterator rend() const noexcept;
+  const_iterator cbegin() const noexcept;
+  const_iterator cend() const noexcept;
+  const_reverse_iterator crbegin() const noexcept;
+  const_reverse_iterator crend() const noexcept;
+  bool empty() const noexcept;
+  size_type size() const noexcept;
+  size_type max_size() const noexcept;
+  void resize(size_type);
+  void resize(size_type, const T &);
+  reference front() noexcept;
+  const_reference front() const noexcept;
+  reference back() noexcept;
+  const_reference back() const noexcept;
+  template<class... Args> void emplace_back(Args &&...);
+  template<class... Args> void emplace_front(Args &&...);
+  template<class... Args> iterator emplace(const_iterator, Args &&...);
+  void push_front(const T &);
+  void push_front(T &&);
+  void push_back(const T &);
+  void push_back(T &&);
+  iterator insert(const_iterator, const T &);
+  iterator insert(const_iterator, T &&);
+  iterator insert(const_iterator, size_type, const T &);
+  template<typename InpIt> iterator insert(const_iterator, InpIt, InpIt);
+  iterator insert(const_iterator, std::initializer_list< value_type >);
+  void pop_front() noexcept;
+  void pop_back() noexcept;
+  iterator erase(const_iterator) noexcept;
+  iterator erase(const_iterator, const_iterator) noexcept;
+  void swap(list &);
+  void clear() noexcept;
+  void splice(const_iterator, list &) noexcept;
+  void splice(const_iterator, list &&) noexcept;
+  void splice(const_iterator, list &, const_iterator) noexcept;
+  void splice(const_iterator, list &&, const_iterator) noexcept;
+  void splice(const_iterator, list &, const_iterator, const_iterator) noexcept;
+  void splice(const_iterator, list &&, const_iterator, const_iterator) noexcept;
+  void splice(const_iterator, list &, const_iterator, const_iterator, 
+              size_type) noexcept;
+  void splice(const_iterator, list &&, const_iterator, const_iterator, 
+              size_type) noexcept;
+  void remove(const T &);
+  template<typename Pred> void remove_if(Pred);
+  void unique();
+  template<typename BinaryPredicate> void unique(BinaryPredicate);
+  void merge(list &);
+  void merge(list &&);
+  template<typename StrictWeakOrdering> 
+    void merge(list &, const StrictWeakOrdering &);
+  template<typename StrictWeakOrdering> 
+    void merge(list &&, StrictWeakOrdering);
+  void sort();
+  template<typename StrictWeakOrdering> void sort(StrictWeakOrdering);
+  void reverse() noexcept;
+
+  // friend functions
+  friend bool operator==(const list &, const list &);
+  friend bool operator!=(const list &, const list &);
+  friend bool operator<(const list &, const list &);
+  friend bool operator>(const list &, const list &);
+  friend bool operator<=(const list &, const list &);
+  friend bool operator>=(const list &, const list &);
+  friend void swap(list &, list &);
 };
-

Description

-

A list is a doubly linked list. That is, it is a Sequence that supports both forward and backward traversal, and (amortized) constant time insertion and removal of elements at the beginning or the end, or in the middle. Lists have the important property that insertion and splicing do not invalidate iterators to list elements, and that even removal invalidates only the iterators that point to the elements that are removed. The ordering of iterators may be changed (that is, list<T>::iterator might have a different predecessor or successor after a list operation than it did before), but the iterators themselves will not be invalidated or made to point to different elements unless that invalidation or mutation is explicit.

+

Description

+

A list is a doubly linked list. That is, it is a Sequence that supports both forward and backward traversal, and (amortized) constant time insertion and removal of elements at the beginning or the end, or in the middle. Lists have the important property that insertion and splicing do not invalidate iterators to list elements, and that even removal invalidates only the iterators that point to the elements that are removed. The ordering of iterators may be changed (that is, list<T>::iterator might have a different predecessor or successor after a list operation than it did before), but the iterators themselves will not be invalidated or made to point to different elements unless that invalidation or mutation is explicit.

+

+

-

-list - public - types

+

Template Parameters

  1. -

    -typedef T value_type;

    -

    The type of object, T, stored in the list

    +
    typename T
    +

    The type of object that is stored in the list

  2. -

    -typedef std::reverse_iterator< const_iterator > const_reverse_iterator;

    -

    Iterator used to iterate backwards through a list. Const iterator used to iterate backwards through a list.

    +
    typename Allocator = std::allocator<T>
    +

    The allocator used for all internal memory management

-

+

list public construct/copy/destruct

  1. -
    list();
    +
    list();

    Effects: Default constructs a list.

    Throws: If allocator_type's default constructor throws.

    Complexity: Constant.

  2. -
    explicit list(const allocator_type & a);
    +
    explicit list(const allocator_type & a) noexcept;

    Effects: Constructs a list taking the allocator as parameter.

    -

    Throws: If allocator_type's copy constructor throws.

    +

    Throws: Nothing

    Complexity: Constant.

  3. -
    explicit list(size_type n);
    +
    explicit list(size_type n);

    Effects: Constructs a list that will use a copy of allocator a and inserts n copies of value.

    -

    Throws: If allocator_type's default constructor or copy constructor throws or T's default or copy constructor throws.

    +

    Throws: If allocator_type's default constructor throws or T's default or copy constructor throws.

    Complexity: Linear to n.

  4. -
    list(size_type n, const T & value, const A & a = A());
    +
    list(size_type n, const T & value, const Allocator & a = Allocator());

    Effects: Constructs a list that will use a copy of allocator a and inserts n copies of value.

    -

    Throws: If allocator_type's default constructor or copy constructor throws or T's default or copy constructor throws.

    +

    Throws: If allocator_type's default constructor throws or T's default or copy constructor throws.

    Complexity: Linear to n.

  5. -
    list(const list & x);
    +
    list(const list & x);

    Effects: Copy constructs a list.

    Postcondition: x == *this.

    -

    Throws: If allocator_type's default constructor or copy constructor throws.

    +

    Throws: If allocator_type's default constructor throws.

    Complexity: Linear to the elements x contains.

  6. -
    list(list && x);
    +
    list(list && x);

    Effects: Move constructor. Moves mx's resources to *this.

    Throws: If allocator_type's copy constructor throws.

    Complexity: Constant.

  7. -
    list(const list & x, const allocator_type & a);
    +
    list(const list & x, const allocator_type & a);

    Effects: Copy constructs a list using the specified allocator.

    Postcondition: x == *this.

    Throws: If allocator_type's default constructor or copy constructor throws.

    Complexity: Linear to the elements x contains.

  8. -
    list(list && x, const allocator_type & a);
    +
    list(list && x, const allocator_type & a);

    Effects: Move constructor sing the specified allocator. Moves mx's resources to *this.

    Throws: If allocation or value_type's copy constructor throws.

    Complexity: Constant if a == x.get_allocator(), linear otherwise.

  9. -
    template<typename InpIt> list(InpIt first, InpIt last, const A & a = A());
    +
    template<typename InpIt> 
    +  list(InpIt first, InpIt last, const Allocator & a = Allocator());

    Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [first, last) in the list.

    -

    Throws: If allocator_type's default constructor or copy constructor throws or T's constructor taking an dereferenced InIt throws.

    +

    Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced InIt throws.

    Complexity: Linear to the range [first, last).

  10. -
    list& operator=(const ThisType & x);
    +
    list(std::initializer_list< value_type > il, 
    +     const Allocator & a = Allocator());
    +

    Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [il.begin(), il.end()) in the list.

    +

    Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced std::initializer_list iterator throws.

    +

    Complexity: Linear to the range [il.begin(), il.end()).

    +
  11. +
  12. +
    list & operator=(const list & x);

    Effects: Makes *this contain the same elements as x.

    Postcondition: this->size() == x.size(). *this contains a copy of each of x's elements.

    Throws: If memory allocation throws or T's copy constructor throws.

    Complexity: Linear to the number of elements in x.

  13. -
    list& operator=(ThisType && x);
    -

    Effects: Move assignment. All mx's values are transferred to *this.

    +
    list & operator=(list && x) noexcept(allocator_traits_type::propagate_on_container_move_assignment::value));
    +

    Effects: Move assignment. All x's values are transferred to *this.

    Postcondition: x.empty(). *this contains a the elements x had before the function.

    -

    Throws: If allocator_type's copy constructor throws.

    -

    Complexity: Constant.

    +

    Throws: If allocator_traits_type::propagate_on_container_move_assignment is false and (allocation throws or value_type's move constructor throws)

    +

    Complexity: Constant if allocator_traits_type:: propagate_on_container_move_assignment is true or this->get>allocator() == x.get_allocator(). Linear otherwise.

    +
  14. +
  15. +
    list & operator=(std::initializer_list< value_type > il);
    +

    Effects: Makes *this contain the same elements as il.

    +

    Postcondition: this->size() == il.size(). *this contains a copy of each of x's elements.

    +

    Throws: If memory allocation throws or T's copy constructor throws.

    +

    Complexity: Linear to the number of elements in x.

  16. -
    ~list();
    +
    ~list();

    Effects: Destroys the list. All stored values are destroyed and used memory is deallocated.

    Throws: Nothing.

    Complexity: Linear to the number of elements.

    @@ -225,375 +262,497 @@
-

-list public member functions

+

+list public member functions

  1. -
    allocator_type get_allocator() const;
    +
    void assign(size_type n, const T & val);
    +

    Effects: Assigns the n copies of val to *this.

    +

    Throws: If memory allocation throws or T's copy constructor throws.

    +

    Complexity: Linear to n.

    +
  2. +
  3. +
    template<typename InpIt> void assign(InpIt first, InpIt last);
    +

    Effects: Assigns the the range [first, last) to *this.

    +

    Throws: If memory allocation throws or T's constructor from dereferencing InpIt throws.

    +

    Complexity: Linear to n.

    +
  4. +
  5. +
    void assign(std::initializer_list< value_type > il);
    +

    Effects: Assigns the the range [il.begin(), il.end()) to *this.

    +

    Throws: If memory allocation throws or T's constructor from dereferencing std::initializer_list iterator throws.

    +

    Complexity: Linear to n.

    +
  6. +
  7. +
    allocator_type get_allocator() const noexcept;

    Effects: Returns a copy of the internal allocator.

    Throws: If allocator's copy constructor throws.

    Complexity: Constant.

  8. -
  9. const stored_allocator_type & get_stored_allocator() const;
  10. -
  11. stored_allocator_type & get_stored_allocator();
  12. -
    void clear();
    -

    Effects: Erases all the elements of the list.

    -

    Throws: Nothing.

    -

    Complexity: Linear to the number of elements in the list.

    +
    stored_allocator_type & get_stored_allocator() noexcept;
    +

    Effects: Returns a reference to the internal allocator.

    +

    Throws: Nothing

    +

    Complexity: Constant.

    +

    Note: Non-standard extension.

    +
  13. +
  14. +
    const stored_allocator_type & get_stored_allocator() const noexcept;
    +

    Effects: Returns a reference to the internal allocator.

    +

    Throws: Nothing

    +

    Complexity: Constant.

    +

    Note: Non-standard extension.

  15. -
    iterator begin();
    +
    iterator begin() noexcept;

    Effects: Returns an iterator to the first element contained in the list.

    Throws: Nothing.

    Complexity: Constant.

  16. -
    const_iterator begin() const;
    +
    const_iterator begin() const noexcept;

    Effects: Returns a const_iterator to the first element contained in the list.

    Throws: Nothing.

    Complexity: Constant.

  17. -
    iterator end();
    +
    iterator end() noexcept;

    Effects: Returns an iterator to the end of the list.

    Throws: Nothing.

    Complexity: Constant.

  18. -
    const_iterator end() const;
    +
    const_iterator end() const noexcept;

    Effects: Returns a const_iterator to the end of the list.

    Throws: Nothing.

    Complexity: Constant.

  19. -
    reverse_iterator rbegin();
    +
    reverse_iterator rbegin() noexcept;

    Effects: Returns a reverse_iterator pointing to the beginning of the reversed list.

    Throws: Nothing.

    Complexity: Constant.

  20. -
    const_reverse_iterator rbegin() const;
    +
    const_reverse_iterator rbegin() const noexcept;

    Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list.

    Throws: Nothing.

    Complexity: Constant.

  21. -
    reverse_iterator rend();
    +
    reverse_iterator rend() noexcept;

    Effects: Returns a reverse_iterator pointing to the end of the reversed list.

    Throws: Nothing.

    Complexity: Constant.

  22. -
    const_reverse_iterator rend() const;
    +
    const_reverse_iterator rend() const noexcept;

    Effects: Returns a const_reverse_iterator pointing to the end of the reversed list.

    Throws: Nothing.

    Complexity: Constant.

  23. -
    const_iterator cbegin() const;
    +
    const_iterator cbegin() const noexcept;

    Effects: Returns a const_iterator to the first element contained in the list.

    Throws: Nothing.

    Complexity: Constant.

  24. -
    const_iterator cend() const;
    +
    const_iterator cend() const noexcept;

    Effects: Returns a const_iterator to the end of the list.

    Throws: Nothing.

    Complexity: Constant.

  25. -
    const_reverse_iterator crbegin() const;
    +
    const_reverse_iterator crbegin() const noexcept;

    Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list.

    Throws: Nothing.

    Complexity: Constant.

  26. -
    const_reverse_iterator crend() const;
    +
    const_reverse_iterator crend() const noexcept;

    Effects: Returns a const_reverse_iterator pointing to the end of the reversed list.

    Throws: Nothing.

    Complexity: Constant.

  27. -
    bool empty() const;
    +
    bool empty() const noexcept;

    Effects: Returns true if the list contains no elements.

    Throws: Nothing.

    Complexity: Constant.

  28. -
    size_type size() const;
    +
    size_type size() const noexcept;

    Effects: Returns the number of the elements contained in the list.

    Throws: Nothing.

    Complexity: Constant.

  29. -
    size_type max_size() const;
    +
    size_type max_size() const noexcept;

    Effects: Returns the largest possible size of the list.

    Throws: Nothing.

    Complexity: Constant.

  30. -
    void push_front(const T & x);
    -

    Effects: Inserts a copy of x at the beginning of the list.

    -

    Throws: If memory allocation throws or T's copy constructor throws.

    -

    Complexity: Amortized constant time.

    -
  31. -
  32. -
    void push_front(T && x);
    -

    Effects: Constructs a new element in the beginning of the list and moves the resources of mx to this new element.

    -

    Throws: If memory allocation throws.

    -

    Complexity: Amortized constant time.

    -
  33. -
  34. -
    void push_back(const T & x);
    -

    Effects: Inserts a copy of x at the end of the list.

    -

    Throws: If memory allocation throws or T's copy constructor throws.

    -

    Complexity: Amortized constant time.

    -
  35. -
  36. -
    void push_back(T && x);
    -

    Effects: Constructs a new element in the end of the list and moves the resources of mx to this new element.

    -

    Throws: If memory allocation throws.

    -

    Complexity: Amortized constant time.

    -
  37. -
  38. -
    void pop_front();
    -

    Effects: Removes the first element from the list.

    -

    Throws: Nothing.

    -

    Complexity: Amortized constant time.

    +
    void resize(size_type new_size);
    +

    Effects: Inserts or erases elements at the end such that the size becomes n. New elements are value initialized.

    +

    Throws: If memory allocation throws, or T's copy constructor throws.

    +

    Complexity: Linear to the difference between size() and new_size.

  39. -
    void pop_back();
    -

    Effects: Removes the last element from the list.

    -

    Throws: Nothing.

    -

    Complexity: Amortized constant time.

    +
    void resize(size_type new_size, const T & x);
    +

    Effects: Inserts or erases elements at the end such that the size becomes n. New elements are copy constructed from x.

    +

    Throws: If memory allocation throws, or T's copy constructor throws.

    +

    Complexity: Linear to the difference between size() and new_size.

  40. -
    reference front();
    +
    reference front() noexcept;

    Requires: !empty()

    Effects: Returns a reference to the first element from the beginning of the container.

    Throws: Nothing.

    Complexity: Constant.

  41. -
    const_reference front() const;
    +
    const_reference front() const noexcept;

    Requires: !empty()

    Effects: Returns a const reference to the first element from the beginning of the container.

    Throws: Nothing.

    Complexity: Constant.

  42. -
    reference back();
    +
    reference back() noexcept;

    Requires: !empty()

    Effects: Returns a reference to the first element from the beginning of the container.

    Throws: Nothing.

    Complexity: Constant.

  43. -
    const_reference back() const;
    +
    const_reference back() const noexcept;

    Requires: !empty()

    Effects: Returns a const reference to the first element from the beginning of the container.

    Throws: Nothing.

    Complexity: Constant.

  44. -
    void resize(size_type new_size, const T & x);
    -

    Effects: Inserts or erases elements at the end such that the size becomes n. New elements are copy constructed from x.

    -

    Throws: If memory allocation throws, or T's copy constructor throws.

    -

    Complexity: Linear to the difference between size() and new_size.

    +
    template<class... Args> void emplace_back(Args &&... args);
    +

    Effects: Inserts an object of type T constructed with std::forward<Args>(args)... in the end of the list.

    +

    Throws: If memory allocation throws or T's in-place constructor throws.

    +

    Complexity: Constant

  45. -
    void resize(size_type new_size);
    -

    Effects: Inserts or erases elements at the end such that the size becomes n. New elements are default constructed.

    -

    Throws: If memory allocation throws, or T's copy constructor throws.

    -

    Complexity: Linear to the difference between size() and new_size.

    +
    template<class... Args> void emplace_front(Args &&... args);
    +

    Effects: Inserts an object of type T constructed with std::forward<Args>(args)... in the beginning of the list.

    +

    Throws: If memory allocation throws or T's in-place constructor throws.

    +

    Complexity: Constant

  46. -
    void swap(ThisType & x);
    -

    Effects: Swaps the contents of *this and x.

    -

    Throws: Nothing.

    -

    Complexity: Constant.

    +
    template<class... Args> iterator emplace(const_iterator p, Args &&... args);
    +

    Effects: Inserts an object of type T constructed with std::forward<Args>(args)... before p.

    +

    Throws: If memory allocation throws or T's in-place constructor throws.

    +

    Complexity: Constant

    +
  47. +
  48. +
    void push_front(const T & x);
    +

    Effects: Inserts a copy of x at the beginning of the list.

    +

    Throws: If memory allocation throws or T's copy constructor throws.

    +

    Complexity: Amortized constant time.

    +
  49. +
  50. +
    void push_front(T && x);
    +

    Effects: Constructs a new element in the beginning of the list and moves the resources of mx to this new element.

    +

    Throws: If memory allocation throws.

    +

    Complexity: Amortized constant time.

    +
  51. +
  52. +
    void push_back(const T & x);
    +

    Effects: Inserts a copy of x at the end of the list.

    +

    Throws: If memory allocation throws or T's copy constructor throws.

    +

    Complexity: Amortized constant time.

    +
  53. +
  54. +
    void push_back(T && x);
    +

    Effects: Constructs a new element in the end of the list and moves the resources of mx to this new element.

    +

    Throws: If memory allocation throws.

    +

    Complexity: Amortized constant time.

    +
  55. +
  56. +
    iterator insert(const_iterator p, const T & x);
    +

    Requires: p must be a valid iterator of *this.

    +

    Effects: Insert a copy of x before p.

    +

    Returns: an iterator to the inserted element.

    +

    Throws: If memory allocation throws or x's copy constructor throws.

    +

    Complexity: Amortized constant time.

  57. -
    void insert(const_iterator p, size_type n, const T & x);
    +
    iterator insert(const_iterator p, T && x);
    +

    Requires: p must be a valid iterator of *this.

    +

    Effects: Insert a new element before p with mx's resources.

    +

    Returns: an iterator to the inserted element.

    +

    Throws: If memory allocation throws.

    +

    Complexity: Amortized constant time.

    +
  58. +
  59. +
    iterator insert(const_iterator p, size_type n, const T & x);

    Requires: p must be a valid iterator of *this.

    Effects: Inserts n copies of x before p.

    +

    Returns: an iterator to the first inserted element or p if n is 0.

    Throws: If memory allocation throws or T's copy constructor throws.

    Complexity: Linear to n.

  60. template<typename InpIt> 
    -  void insert(const_iterator p, InpIt first, InpIt last);
    + iterator insert(const_iterator p, InpIt first, InpIt last);

    Requires: p must be a valid iterator of *this.

    Effects: Insert a copy of the [first, last) range before p.

    +

    Returns: an iterator to the first inserted element or p if first == last.

    Throws: If memory allocation throws, T's constructor from a dereferenced InpIt throws.

    Complexity: Linear to std::distance [first, last).

  61. -
    iterator insert(const_iterator position, const T & x);
    -

    Requires: position must be a valid iterator of *this.

    -

    Effects: Insert a copy of x before position.

    -

    Throws: If memory allocation throws or x's copy constructor throws.

    -

    Complexity: Amortized constant time.

    +
    iterator insert(const_iterator p, std::initializer_list< value_type > il);
    +

    Requires: p must be a valid iterator of *this.

    +

    Effects: Insert a copy of the [il.begin(), il.end()) range before p.

    +

    Returns: an iterator to the first inserted element or p if if.begin() == il.end().

    +

    Throws: If memory allocation throws, T's constructor from a dereferenced std::initializer_list iterator throws.

    +

    Complexity: Linear to std::distance [il.begin(), il.end()).

  62. -
    iterator insert(const_iterator position, T && x);
    -

    Requires: position must be a valid iterator of *this.

    -

    Effects: Insert a new element before position with mx's resources.

    -

    Throws: If memory allocation throws.

    +
    void pop_front() noexcept;
    +

    Effects: Removes the first element from the list.

    +

    Throws: Nothing.

    Complexity: Amortized constant time.

  63. -
    template<class... Args> void emplace_back(Args &&... args);
    -

    Effects: Inserts an object of type T constructed with std::forward<Args>(args)... in the end of the list.

    -

    Throws: If memory allocation throws or T's in-place constructor throws.

    -

    Complexity: Constant

    -
  64. -
  65. -
    template<class... Args> void emplace_front(Args &&... args);
    -

    Effects: Inserts an object of type T constructed with std::forward<Args>(args)... in the beginning of the list.

    -

    Throws: If memory allocation throws or T's in-place constructor throws.

    -

    Complexity: Constant

    -
  66. -
  67. -
    template<class... Args> iterator emplace(const_iterator p, Args &&... args);
    -

    Effects: Inserts an object of type T constructed with std::forward<Args>(args)... before p.

    -

    Throws: If memory allocation throws or T's in-place constructor throws.

    -

    Complexity: Constant

    +
    void pop_back() noexcept;
    +

    Effects: Removes the last element from the list.

    +

    Throws: Nothing.

    +

    Complexity: Amortized constant time.

  68. -
    iterator erase(const_iterator p);
    +
    iterator erase(const_iterator p) noexcept;

    Requires: p must be a valid iterator of *this.

    Effects: Erases the element at p p.

    Throws: Nothing.

    Complexity: Amortized constant time.

  69. -
    iterator erase(const_iterator first, const_iterator last);
    +
    iterator erase(const_iterator first, const_iterator last) noexcept;

    Requires: first and last must be valid iterator to elements in *this.

    Effects: Erases the elements pointed by [first, last).

    Throws: Nothing.

    Complexity: Linear to the distance between first and last.

  70. -
    void assign(size_type n, const T & val);
    -

    Effects: Assigns the n copies of val to *this.

    -

    Throws: If memory allocation throws or T's copy constructor throws.

    -

    Complexity: Linear to n.

    +
    void swap(list & x);
    +

    Effects: Swaps the contents of *this and x.

    +

    Throws: Nothing.

    +

    Complexity: Constant.

  71. -
    template<typename InpIt> void assign(InpIt first, InpIt last);
    -

    Effects: Assigns the the range [first, last) to *this.

    -

    Throws: If memory allocation throws or T's constructor from dereferencing InpIt throws.

    -

    Complexity: Linear to n.

    +
    void clear() noexcept;
    +

    Effects: Erases all the elements of the list.

    +

    Throws: Nothing.

    +

    Complexity: Linear to the number of elements in the list.

  72. -
    void splice(const_iterator p, ThisType & x);
    -

    Requires: p must point to an element contained by the list. x != *this

    +
    void splice(const_iterator p, list & x) noexcept;
    +

    Requires: p must point to an element contained by the list. x != *this. this' allocator and x's allocator shall compare equal

    Effects: Transfers all the elements of list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

    -

    Throws: std::runtime_error if this' allocator and x's allocator are not equal.

    +

    Throws: Nothing

    Complexity: Constant.

    Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

  73. -
    void splice(const_iterator p, ThisType & x, const_iterator i);
    -

    Requires: p must point to an element contained by this list. i must point to an element contained in list x.

    +
    void splice(const_iterator p, list && x) noexcept;
    +

    Requires: p must point to an element contained by the list. x != *this. this' allocator and x's allocator shall compare equal

    +

    Effects: Transfers all the elements of list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

    +

    Throws: Nothing

    +

    Complexity: Constant.

    +

    Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

    +
  74. +
  75. +
    void splice(const_iterator p, list & x, const_iterator i) noexcept;
    +

    Requires: p must point to an element contained by this list. i must point to an element contained in list x. this' allocator and x's allocator shall compare equal

    Effects: Transfers the value pointed by i, from list x to this list, before the the element pointed by p. No destructors or copy constructors are called. If p == i or p == ++i, this function is a null operation.

    -

    Throws: std::runtime_error if this' allocator and x's allocator are not equal.

    +

    Throws: Nothing

    Complexity: Constant.

    Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

  76. -
    void splice(const_iterator p, ThisType & x, const_iterator first, 
    -            const_iterator last);
    -

    Requires: p must point to an element contained by this list. first and last must point to elements contained in list x.

    +
    void splice(const_iterator p, list && x, const_iterator i) noexcept;
    +

    Requires: p must point to an element contained by this list. i must point to an element contained in list x. this' allocator and x's allocator shall compare equal.

    +

    Effects: Transfers the value pointed by i, from list x to this list, before the the element pointed by p. No destructors or copy constructors are called. If p == i or p == ++i, this function is a null operation.

    +

    Throws: Nothing

    +

    Complexity: Constant.

    +

    Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

    +
  77. +
  78. +
    void splice(const_iterator p, list & x, const_iterator first, 
    +            const_iterator last) noexcept;
    +

    Requires: p must point to an element contained by this list. first and last must point to elements contained in list x. this' allocator and x's allocator shall compare equal

    Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

    -

    Throws: std::runtime_error if this' allocator and x's allocator are not equal.

    +

    Throws: Nothing

    Complexity: Linear to the number of elements transferred.

    Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

  79. -
    void splice(const_iterator p, ThisType & x, const_iterator first, 
    -            const_iterator last, size_type n);
    -

    Requires: p must point to an element contained by this list. first and last must point to elements contained in list x. n == std::distance(first, last)

    +
    void splice(const_iterator p, list && x, const_iterator first, 
    +            const_iterator last) noexcept;
    +

    Requires: p must point to an element contained by this list. first and last must point to elements contained in list x. this' allocator and x's allocator shall compare equal.

    Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

    -

    Throws: std::runtime_error if this' allocator and x's allocator are not equal.

    -

    Complexity: Constant.

    +

    Throws: Nothing

    +

    Complexity: Linear to the number of elements transferred.

    Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

  80. -
    void reverse();
    -

    Effects: Reverses the order of elements in the list.

    -

    Throws: Nothing.

    -

    Complexity: This function is linear time.

    -

    Note: Iterators and references are not invalidated

    +
    void splice(const_iterator p, list & x, const_iterator first, 
    +            const_iterator last, size_type n) noexcept;
    +

    Requires: p must point to an element contained by this list. first and last must point to elements contained in list x. n == std::distance(first, last). this' allocator and x's allocator shall compare equal

    +

    Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

    +

    Throws: Nothing

    +

    Complexity: Constant.

    +

    Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

    +

    Note: Non-standard extension

    +
  81. +
  82. +
    void splice(const_iterator p, list && x, const_iterator first, 
    +            const_iterator last, size_type n) noexcept;
    +

    Requires: p must point to an element contained by this list. first and last must point to elements contained in list x. n == std::distance(first, last). this' allocator and x's allocator shall compare equal

    +

    Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

    +

    Throws: Nothing

    +

    Complexity: Constant.

    +

    Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

    +

    Note: Non-standard extension

  83. -
    void remove(const T & value);
    +
    void remove(const T & value);

    Effects: Removes all the elements that compare equal to value.

    -

    Throws: Nothing.

    +

    Throws: If comparison throws.

    Complexity: Linear time. It performs exactly size() comparisons for equality.

    Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

  84. -
    template<typename Pred> void remove_if(Pred pred);
    +
    template<typename Pred> void remove_if(Pred pred);

    Effects: Removes all the elements for which a specified predicate is satisfied.

    Throws: If pred throws.

    Complexity: Linear time. It performs exactly size() calls to the predicate.

    Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

  85. -
    void unique();
    +
    void unique();

    Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list.

    -

    Throws: Nothing.

    -

    Complexity: Linear time (size()-1 comparisons calls to pred()).

    +

    Throws: If comparison throws.

    +

    Complexity: Linear time (size()-1 comparisons equality comparisons).

    Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

  86. -
    template<typename BinaryPredicate> void unique(BinaryPredicate binary_pred);
    +
    template<typename BinaryPredicate> void unique(BinaryPredicate binary_pred);

    Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list.

    Throws: If pred throws.

    -

    Complexity: Linear time (size()-1 comparisons equality comparisons).

    +

    Complexity: Linear time (size()-1 comparisons calls to pred()).

    Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

  87. -
    void merge(list< T, A > & x);
    +
    void merge(list & x);

    Requires: The lists x and *this must be distinct.

    Effects: This function removes all of x's elements and inserts them in order into *this according to std::less<value_type>. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

    -

    Throws: Nothing.

    +

    Throws: If comparison throws.

    +

    Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

    +
  88. +
  89. +
    void merge(list && x);
    +

    Requires: The lists x and *this must be distinct.

    +

    Effects: This function removes all of x's elements and inserts them in order into *this according to std::less<value_type>. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

    +

    Throws: If comparison throws.

    Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

  90. template<typename StrictWeakOrdering> 
    -  void merge(list & x, StrictWeakOrdering comp);
    + void merge(list & x, const StrictWeakOrdering & comp);

    Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct.

    Effects: This function removes all of x's elements and inserts them in order into *this. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

    -

    Throws: Nothing.

    +

    Throws: If comp throws.

    +

    Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

    +

    Note: Iterators and references to *this are not invalidated.

    +
  91. +
  92. +
    template<typename StrictWeakOrdering> 
    +  void merge(list && x, StrictWeakOrdering comp);
    +

    Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct.

    +

    Effects: This function removes all of x's elements and inserts them in order into *this. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

    +

    Throws: If comp throws.

    Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

    Note: Iterators and references to *this are not invalidated.

  93. -
    void sort();
    +
    void sort();

    Effects: This function sorts the list *this according to std::less<value_type>. The sort is stable, that is, the relative order of equivalent elements is preserved.

    -

    Throws: Nothing.

    +

    Throws: If comparison throws.

    Notes: Iterators and references are not invalidated.

    Complexity: The number of comparisons is approximately N log N, where N is the list's size.

  94. -
    template<typename StrictWeakOrdering> void sort(StrictWeakOrdering comp);
    +
    template<typename StrictWeakOrdering> void sort(StrictWeakOrdering comp);

    Effects: This function sorts the list *this according to std::less<value_type>. The sort is stable, that is, the relative order of equivalent elements is preserved.

    -

    Throws: Nothing.

    +

    Throws: If comp throws.

    Notes: Iterators and references are not invalidated.

    Complexity: The number of comparisons is approximately N log N, where N is the list's size.

  95. +
  96. +
    void reverse() noexcept;
    +

    Effects: Reverses the order of elements in the list.

    +

    Throws: Nothing.

    +

    Complexity: This function is linear time.

    +

    Note: Iterators and references are not invalidated

    +
  97. +
+
+
+

+list friend functions

+
    +
  1. +
    friend bool operator==(const list & x, const list & y);
    +

    Effects: Returns true if x and y are equal

    +

    Complexity: Linear to the number of elements in the container.

    +
  2. +
  3. +
    friend bool operator!=(const list & x, const list & y);
    +

    Effects: Returns true if x and y are unequal

    +

    Complexity: Linear to the number of elements in the container.

    +
  4. +
  5. +
    friend bool operator<(const list & x, const list & y);
    +

    Effects: Returns true if x is less than y

    +

    Complexity: Linear to the number of elements in the container.

    +
  6. +
  7. +
    friend bool operator>(const list & x, const list & y);
    +

    Effects: Returns true if x is greater than y

    +

    Complexity: Linear to the number of elements in the container.

    +
  8. +
  9. +
    friend bool operator<=(const list & x, const list & y);
    +

    Effects: Returns true if x is equal or less than y

    +

    Complexity: Linear to the number of elements in the container.

    +
  10. +
  11. +
    friend bool operator>=(const list & x, const list & y);
    +

    Effects: Returns true if x is equal or greater than y

    +

    Complexity: Linear to the number of elements in the container.

    +
  12. +
  13. +
    friend void swap(list & x, list & y);
    +

    Effects: x.swap(y)

    +

    Complexity: Constant.

    +
-