From Jason Turner

[list.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdfup5uwa/{from.md → to.md} +28 -17
tmp/tmpdfup5uwa/{from.md → to.md} RENAMED
@@ -4,19 +4,21 @@ A `list` is a sequence container that supports bidirectional iterators
4
  and allows constant time insert and erase operations anywhere within the
5
  sequence, with storage management handled automatically. Unlike vectors
6
  [[vector]] and deques [[deque]], fast random access to list elements is
7
  not supported, but many algorithms only need sequential access anyway.
8
 
9
- A `list` meets all of the requirements of a container, of a reversible
10
- container (given in two tables in [[container.requirements]]), of a
11
- sequence container, including most of the optional sequence container
12
- requirements [[sequence.reqmts]], and of an allocator-aware container (
13
- [[container.alloc.req]]). The exceptions are the `operator[]` and `at`
14
- member functions, which are not provided.[^2] Descriptions are provided
15
- here only for operations on `list` that are not described in one of
16
- these tables or for operations where there is additional semantic
17
- information.
 
 
18
 
19
  ``` cpp
20
  namespace std {
21
  template<class T, class Allocator = allocator<T>>
22
  class list {
@@ -26,12 +28,12 @@ namespace std {
26
  using allocator_type = Allocator;
27
  using pointer = typename allocator_traits<Allocator>::pointer;
28
  using const_pointer = typename allocator_traits<Allocator>::const_pointer;
29
  using reference = value_type&;
30
  using const_reference = const value_type&;
31
- using size_type = implementation-defined; // see [container.requirements]
32
- using difference_type = implementation-defined; // see [container.requirements]
33
  using iterator = implementation-defined // type of list::iterator; // see [container.requirements]
34
  using const_iterator = implementation-defined // type of list::const_iterator; // see [container.requirements]
35
  using reverse_iterator = std::reverse_iterator<iterator>;
36
  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
37
 
@@ -40,22 +42,26 @@ namespace std {
40
  explicit list(const Allocator&);
41
  explicit list(size_type n, const Allocator& = Allocator());
42
  list(size_type n, const T& value, const Allocator& = Allocator());
43
  template<class InputIterator>
44
  list(InputIterator first, InputIterator last, const Allocator& = Allocator());
 
 
45
  list(const list& x);
46
  list(list&& x);
47
- list(const list&, const Allocator&);
48
- list(list&&, const Allocator&);
49
  list(initializer_list<T>, const Allocator& = Allocator());
50
  ~list();
51
  list& operator=(const list& x);
52
  list& operator=(list&& x)
53
  noexcept(allocator_traits<Allocator>::is_always_equal::value);
54
  list& operator=(initializer_list<T>);
55
  template<class InputIterator>
56
  void assign(InputIterator first, InputIterator last);
 
 
57
  void assign(size_type n, const T& t);
58
  void assign(initializer_list<T>);
59
  allocator_type get_allocator() const noexcept;
60
 
61
  // iterators
@@ -89,21 +95,27 @@ namespace std {
89
  // [list.modifiers], modifiers
90
  template<class... Args> reference emplace_front(Args&&... args);
91
  template<class... Args> reference emplace_back(Args&&... args);
92
  void push_front(const T& x);
93
  void push_front(T&& x);
 
 
94
  void pop_front();
95
  void push_back(const T& x);
96
  void push_back(T&& x);
 
 
97
  void pop_back();
98
 
99
  template<class... Args> iterator emplace(const_iterator position, Args&&... args);
100
  iterator insert(const_iterator position, const T& x);
101
  iterator insert(const_iterator position, T&& x);
102
  iterator insert(const_iterator position, size_type n, const T& x);
103
  template<class InputIterator>
104
  iterator insert(const_iterator position, InputIterator first, InputIterator last);
 
 
105
  iterator insert(const_iterator position, initializer_list<T> il);
106
 
107
  iterator erase(const_iterator position);
108
  iterator erase(const_iterator position, const_iterator last);
109
  void swap(list&) noexcept(allocator_traits<Allocator>::is_always_equal::value);
@@ -137,14 +149,13 @@ namespace std {
137
 
138
  template<class InputIterator, class Allocator = allocator<iter-value-type<InputIterator>>>
139
  list(InputIterator, InputIterator, Allocator = Allocator())
140
  -> list<iter-value-type<InputIterator>, Allocator>;
141
 
142
- // swap
143
- template<class T, class Allocator>
144
- void swap(list<T, Allocator>& x, list<T, Allocator>& y)
145
- noexcept(noexcept(x.swap(y)));
146
  }
147
  ```
148
 
149
  An incomplete type `T` may be used when instantiating `list` if the
150
  allocator meets the allocator completeness requirements
 
4
  and allows constant time insert and erase operations anywhere within the
5
  sequence, with storage management handled automatically. Unlike vectors
6
  [[vector]] and deques [[deque]], fast random access to list elements is
7
  not supported, but many algorithms only need sequential access anyway.
8
 
9
+ A `list` meets all of the requirements of a container
10
+ [[container.reqmts]], of a reversible container
11
+ [[container.rev.reqmts]], of an allocator-aware container
12
+ [[container.alloc.reqmts]], and of a sequence container, including most
13
+ of the optional sequence container requirements [[sequence.reqmts]]. The
14
+ exceptions are the `operator[]` and `at` member functions, which are not
15
+ provided.[^2]
16
+
17
+ Descriptions are provided here only for operations on `list` that are
18
+ not described in one of these tables or for operations where there is
19
+ additional semantic information.
20
 
21
  ``` cpp
22
  namespace std {
23
  template<class T, class Allocator = allocator<T>>
24
  class list {
 
28
  using allocator_type = Allocator;
29
  using pointer = typename allocator_traits<Allocator>::pointer;
30
  using const_pointer = typename allocator_traits<Allocator>::const_pointer;
31
  using reference = value_type&;
32
  using const_reference = const value_type&;
33
+ using size_type = implementation-defined // type of list::size_type; // see [container.requirements]
34
+ using difference_type = implementation-defined // type of list::difference_type; // see [container.requirements]
35
  using iterator = implementation-defined // type of list::iterator; // see [container.requirements]
36
  using const_iterator = implementation-defined // type of list::const_iterator; // see [container.requirements]
37
  using reverse_iterator = std::reverse_iterator<iterator>;
38
  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
39
 
 
42
  explicit list(const Allocator&);
43
  explicit list(size_type n, const Allocator& = Allocator());
44
  list(size_type n, const T& value, const Allocator& = Allocator());
45
  template<class InputIterator>
46
  list(InputIterator first, InputIterator last, const Allocator& = Allocator());
47
+ template<container-compatible-range<T> R>
48
+ list(from_range_t, R&& rg, const Allocator& = Allocator());
49
  list(const list& x);
50
  list(list&& x);
51
+ list(const list&, const type_identity_t<Allocator>&);
52
+ list(list&&, const type_identity_t<Allocator>&);
53
  list(initializer_list<T>, const Allocator& = Allocator());
54
  ~list();
55
  list& operator=(const list& x);
56
  list& operator=(list&& x)
57
  noexcept(allocator_traits<Allocator>::is_always_equal::value);
58
  list& operator=(initializer_list<T>);
59
  template<class InputIterator>
60
  void assign(InputIterator first, InputIterator last);
61
+ template<container-compatible-range<T> R>
62
+ void assign_range(R&& rg);
63
  void assign(size_type n, const T& t);
64
  void assign(initializer_list<T>);
65
  allocator_type get_allocator() const noexcept;
66
 
67
  // iterators
 
95
  // [list.modifiers], modifiers
96
  template<class... Args> reference emplace_front(Args&&... args);
97
  template<class... Args> reference emplace_back(Args&&... args);
98
  void push_front(const T& x);
99
  void push_front(T&& x);
100
+ template<container-compatible-range<T> R>
101
+ void prepend_range(R&& rg);
102
  void pop_front();
103
  void push_back(const T& x);
104
  void push_back(T&& x);
105
+ template<container-compatible-range<T> R>
106
+ void append_range(R&& rg);
107
  void pop_back();
108
 
109
  template<class... Args> iterator emplace(const_iterator position, Args&&... args);
110
  iterator insert(const_iterator position, const T& x);
111
  iterator insert(const_iterator position, T&& x);
112
  iterator insert(const_iterator position, size_type n, const T& x);
113
  template<class InputIterator>
114
  iterator insert(const_iterator position, InputIterator first, InputIterator last);
115
+ template<container-compatible-range<T> R>
116
+ iterator insert_range(const_iterator position, R&& rg);
117
  iterator insert(const_iterator position, initializer_list<T> il);
118
 
119
  iterator erase(const_iterator position);
120
  iterator erase(const_iterator position, const_iterator last);
121
  void swap(list&) noexcept(allocator_traits<Allocator>::is_always_equal::value);
 
149
 
150
  template<class InputIterator, class Allocator = allocator<iter-value-type<InputIterator>>>
151
  list(InputIterator, InputIterator, Allocator = Allocator())
152
  -> list<iter-value-type<InputIterator>, Allocator>;
153
 
154
+ template<ranges::input_range R, class Allocator = allocator<ranges::range_value_t<R>>>
155
+ list(from_range_t, R&&, Allocator = Allocator())
156
+ -> list<ranges::range_value_t<R>, Allocator>;
 
157
  }
158
  ```
159
 
160
  An incomplete type `T` may be used when instantiating `list` if the
161
  allocator meets the allocator completeness requirements