From Jason Turner

[forward.list.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmppaawc2la/{from.md → to.md} +76 -70
tmp/tmppaawc2la/{from.md → to.md} RENAMED
@@ -9,11 +9,11 @@ access to list elements is not supported.
9
  overhead relative to a hand-written C-style singly linked list. Features
10
  that would conflict with that goal have been omitted. — *end note*]
11
 
12
  A `forward_list` meets all of the requirements of a container
13
  [[container.reqmts]], except that the `size()` member function is not
14
- provided and `operator==` has linear complexity, A `forward_list` also
15
  meets all of the requirements for an allocator-aware container
16
  [[container.alloc.reqmts]]. In addition, a `forward_list` provides the
17
  `assign` member functions and several of the optional sequence container
18
  requirements [[sequence.reqmts]]. Descriptions are provided here only
19
  for operations on `forward_list` that are not described in that table or
@@ -23,127 +23,133 @@ for operations where there is additional semantic information.
23
  the first element of interest, but in a `forward_list` there is no
24
  constant-time way to access a preceding element. For this reason,
25
  `erase_after` and `splice_after` take fully-open ranges, not semi-open
26
  ranges. — *end note*]
27
 
 
 
 
28
  ``` cpp
29
  namespace std {
30
  template<class T, class Allocator = allocator<T>>
31
  class forward_list {
32
  public:
33
  // types
34
  using value_type = T;
35
  using allocator_type = Allocator;
36
- using pointer = typename allocator_traits<Allocator>::pointer;
37
- using const_pointer = typename allocator_traits<Allocator>::const_pointer;
38
  using reference = value_type&;
39
  using const_reference = const value_type&;
40
  using size_type = implementation-defined // type of forward_list::size_type; // see [container.requirements]
41
  using difference_type = implementation-defined // type of forward_list::difference_type; // see [container.requirements]
42
  using iterator = implementation-defined // type of forward_list::iterator; // see [container.requirements]
43
  using const_iterator = implementation-defined // type of forward_list::const_iterator; // see [container.requirements]
44
 
45
  // [forward.list.cons], construct/copy/destroy
46
- forward_list() : forward_list(Allocator()) { }
47
- explicit forward_list(const Allocator&);
48
- explicit forward_list(size_type n, const Allocator& = Allocator());
49
- forward_list(size_type n, const T& value, const Allocator& = Allocator());
50
  template<class InputIterator>
51
- forward_list(InputIterator first, InputIterator last, const Allocator& = Allocator());
 
52
  template<container-compatible-range<T> R>
53
- forward_list(from_range_t, R&& rg, const Allocator& = Allocator());
54
- forward_list(const forward_list& x);
55
- forward_list(forward_list&& x);
56
- forward_list(const forward_list& x, const type_identity_t<Allocator>&);
57
- forward_list(forward_list&& x, const type_identity_t<Allocator>&);
58
- forward_list(initializer_list<T>, const Allocator& = Allocator());
59
- ~forward_list();
60
- forward_list& operator=(const forward_list& x);
61
- forward_list& operator=(forward_list&& x)
62
  noexcept(allocator_traits<Allocator>::is_always_equal::value);
63
- forward_list& operator=(initializer_list<T>);
64
  template<class InputIterator>
65
- void assign(InputIterator first, InputIterator last);
66
  template<container-compatible-range<T> R>
67
- void assign_range(R&& rg);
68
- void assign(size_type n, const T& t);
69
- void assign(initializer_list<T>);
70
- allocator_type get_allocator() const noexcept;
71
 
72
  // [forward.list.iter], iterators
73
- iterator before_begin() noexcept;
74
- const_iterator before_begin() const noexcept;
75
- iterator begin() noexcept;
76
- const_iterator begin() const noexcept;
77
- iterator end() noexcept;
78
- const_iterator end() const noexcept;
79
 
80
- const_iterator cbegin() const noexcept;
81
- const_iterator cbefore_begin() const noexcept;
82
- const_iterator cend() const noexcept;
83
 
84
  // capacity
85
- [[nodiscard]] bool empty() const noexcept;
86
- size_type max_size() const noexcept;
87
 
88
  // [forward.list.access], element access
89
- reference front();
90
- const_reference front() const;
91
 
92
  // [forward.list.modifiers], modifiers
93
- template<class... Args> reference emplace_front(Args&&... args);
94
- void push_front(const T& x);
95
- void push_front(T&& x);
96
  template<container-compatible-range<T> R>
97
- void prepend_range(R&& rg);
98
- void pop_front();
99
 
100
- template<class... Args> iterator emplace_after(const_iterator position, Args&&... args);
101
- iterator insert_after(const_iterator position, const T& x);
102
- iterator insert_after(const_iterator position, T&& x);
 
103
 
104
- iterator insert_after(const_iterator position, size_type n, const T& x);
105
  template<class InputIterator>
106
- iterator insert_after(const_iterator position, InputIterator first, InputIterator last);
107
- iterator insert_after(const_iterator position, initializer_list<T> il);
 
108
  template<container-compatible-range<T> R>
109
- iterator insert_range_after(const_iterator position, R&& rg);
110
 
111
- iterator erase_after(const_iterator position);
112
- iterator erase_after(const_iterator position, const_iterator last);
113
- void swap(forward_list&)
114
  noexcept(allocator_traits<Allocator>::is_always_equal::value);
115
 
116
- void resize(size_type sz);
117
- void resize(size_type sz, const value_type& c);
118
- void clear() noexcept;
119
 
120
  // [forward.list.ops], forward_list operations
121
- void splice_after(const_iterator position, forward_list& x);
122
- void splice_after(const_iterator position, forward_list&& x);
123
- void splice_after(const_iterator position, forward_list& x, const_iterator i);
124
- void splice_after(const_iterator position, forward_list&& x, const_iterator i);
125
- void splice_after(const_iterator position, forward_list& x,
126
  const_iterator first, const_iterator last);
127
- void splice_after(const_iterator position, forward_list&& x,
128
  const_iterator first, const_iterator last);
129
 
130
- size_type remove(const T& value);
131
- template<class Predicate> size_type remove_if(Predicate pred);
132
 
133
  size_type unique();
134
- template<class BinaryPredicate> size_type unique(BinaryPredicate binary_pred);
135
 
136
- void merge(forward_list& x);
137
- void merge(forward_list&& x);
138
- template<class Compare> void merge(forward_list& x, Compare comp);
139
- template<class Compare> void merge(forward_list&& x, Compare comp);
140
 
141
- void sort();
142
- template<class Compare> void sort(Compare comp);
143
 
144
- void reverse() noexcept;
145
  };
146
 
147
  template<class InputIterator, class Allocator = allocator<iter-value-type<InputIterator>>>
148
  forward_list(InputIterator, InputIterator, Allocator = Allocator())
149
  -> forward_list<iter-value-type<InputIterator>, Allocator>;
 
9
  overhead relative to a hand-written C-style singly linked list. Features
10
  that would conflict with that goal have been omitted. — *end note*]
11
 
12
  A `forward_list` meets all of the requirements of a container
13
  [[container.reqmts]], except that the `size()` member function is not
14
+ provided and `operator==` has linear complexity. A `forward_list` also
15
  meets all of the requirements for an allocator-aware container
16
  [[container.alloc.reqmts]]. In addition, a `forward_list` provides the
17
  `assign` member functions and several of the optional sequence container
18
  requirements [[sequence.reqmts]]. Descriptions are provided here only
19
  for operations on `forward_list` that are not described in that table or
 
23
  the first element of interest, but in a `forward_list` there is no
24
  constant-time way to access a preceding element. For this reason,
25
  `erase_after` and `splice_after` take fully-open ranges, not semi-open
26
  ranges. — *end note*]
27
 
28
+ The types `iterator` and `const_iterator` meet the constexpr iterator
29
+ requirements [[iterator.requirements.general]].
30
+
31
  ``` cpp
32
  namespace std {
33
  template<class T, class Allocator = allocator<T>>
34
  class forward_list {
35
  public:
36
  // types
37
  using value_type = T;
38
  using allocator_type = Allocator;
39
+ using pointer = allocator_traits<Allocator>::pointer;
40
+ using const_pointer = allocator_traits<Allocator>::const_pointer;
41
  using reference = value_type&;
42
  using const_reference = const value_type&;
43
  using size_type = implementation-defined // type of forward_list::size_type; // see [container.requirements]
44
  using difference_type = implementation-defined // type of forward_list::difference_type; // see [container.requirements]
45
  using iterator = implementation-defined // type of forward_list::iterator; // see [container.requirements]
46
  using const_iterator = implementation-defined // type of forward_list::const_iterator; // see [container.requirements]
47
 
48
  // [forward.list.cons], construct/copy/destroy
49
+ constexpr forward_list() : forward_list(Allocator()) { }
50
+ constexpr explicit forward_list(const Allocator&);
51
+ constexpr explicit forward_list(size_type n, const Allocator& = Allocator());
52
+ constexpr forward_list(size_type n, const T& value, const Allocator& = Allocator());
53
  template<class InputIterator>
54
+ constexpr forward_list(InputIterator first, InputIterator last,
55
+ const Allocator& = Allocator());
56
  template<container-compatible-range<T> R>
57
+ constexpr forward_list(from_range_t, R&& rg, const Allocator& = Allocator());
58
+ constexpr forward_list(const forward_list& x);
59
+ constexpr forward_list(forward_list&& x);
60
+ constexpr forward_list(const forward_list& x, const type_identity_t<Allocator>&);
61
+ constexpr forward_list(forward_list&& x, const type_identity_t<Allocator>&);
62
+ constexpr forward_list(initializer_list<T>, const Allocator& = Allocator());
63
+ constexpr ~forward_list();
64
+ constexpr forward_list& operator=(const forward_list& x);
65
+ constexpr forward_list& operator=(forward_list&& x)
66
  noexcept(allocator_traits<Allocator>::is_always_equal::value);
67
+ constexpr forward_list& operator=(initializer_list<T>);
68
  template<class InputIterator>
69
+ constexpr void assign(InputIterator first, InputIterator last);
70
  template<container-compatible-range<T> R>
71
+ constexpr void assign_range(R&& rg);
72
+ constexpr void assign(size_type n, const T& t);
73
+ constexpr void assign(initializer_list<T>);
74
+ constexpr allocator_type get_allocator() const noexcept;
75
 
76
  // [forward.list.iter], iterators
77
+ constexpr iterator before_begin() noexcept;
78
+ constexpr const_iterator before_begin() const noexcept;
79
+ constexpr iterator begin() noexcept;
80
+ constexpr const_iterator begin() const noexcept;
81
+ constexpr iterator end() noexcept;
82
+ constexpr const_iterator end() const noexcept;
83
 
84
+ constexpr const_iterator cbegin() const noexcept;
85
+ constexpr const_iterator cbefore_begin() const noexcept;
86
+ constexpr const_iterator cend() const noexcept;
87
 
88
  // capacity
89
+ constexpr bool empty() const noexcept;
90
+ constexpr size_type max_size() const noexcept;
91
 
92
  // [forward.list.access], element access
93
+ constexpr reference front();
94
+ constexpr const_reference front() const;
95
 
96
  // [forward.list.modifiers], modifiers
97
+ template<class... Args> constexpr reference emplace_front(Args&&... args);
98
+ constexpr void push_front(const T& x);
99
+ constexpr void push_front(T&& x);
100
  template<container-compatible-range<T> R>
101
+ constexpr void prepend_range(R&& rg);
102
+ constexpr void pop_front();
103
 
104
+ template<class... Args>
105
+ constexpr iterator emplace_after(const_iterator position, Args&&... args);
106
+ constexpr iterator insert_after(const_iterator position, const T& x);
107
+ constexpr iterator insert_after(const_iterator position, T&& x);
108
 
109
+ constexpr iterator insert_after(const_iterator position, size_type n, const T& x);
110
  template<class InputIterator>
111
+ constexpr iterator insert_after(const_iterator position,
112
+ InputIterator first, InputIterator last);
113
+ constexpr iterator insert_after(const_iterator position, initializer_list<T> il);
114
  template<container-compatible-range<T> R>
115
+ constexpr iterator insert_range_after(const_iterator position, R&& rg);
116
 
117
+ constexpr iterator erase_after(const_iterator position);
118
+ constexpr iterator erase_after(const_iterator position, const_iterator last);
119
+ constexpr void swap(forward_list&)
120
  noexcept(allocator_traits<Allocator>::is_always_equal::value);
121
 
122
+ constexpr void resize(size_type sz);
123
+ constexpr void resize(size_type sz, const value_type& c);
124
+ constexpr void clear() noexcept;
125
 
126
  // [forward.list.ops], forward_list operations
127
+ constexpr void splice_after(const_iterator position, forward_list& x);
128
+ constexpr void splice_after(const_iterator position, forward_list&& x);
129
+ constexpr void splice_after(const_iterator position, forward_list& x, const_iterator i);
130
+ constexpr void splice_after(const_iterator position, forward_list&& x, const_iterator i);
131
+ constexpr void splice_after(const_iterator position, forward_list& x,
132
  const_iterator first, const_iterator last);
133
+ constexpr void splice_after(const_iterator position, forward_list&& x,
134
  const_iterator first, const_iterator last);
135
 
136
+ constexpr size_type remove(const T& value);
137
+ template<class Predicate> constexpr size_type remove_if(Predicate pred);
138
 
139
  size_type unique();
140
+ template<class BinaryPredicate> constexpr size_type unique(BinaryPredicate binary_pred);
141
 
142
+ constexpr void merge(forward_list& x);
143
+ constexpr void merge(forward_list&& x);
144
+ template<class Compare> constexpr void merge(forward_list& x, Compare comp);
145
+ template<class Compare> constexpr void merge(forward_list&& x, Compare comp);
146
 
147
+ constexpr void sort();
148
+ template<class Compare> constexpr void sort(Compare comp);
149
 
150
+ constexpr void reverse() noexcept;
151
  };
152
 
153
  template<class InputIterator, class Allocator = allocator<iter-value-type<InputIterator>>>
154
  forward_list(InputIterator, InputIterator, Allocator = Allocator())
155
  -> forward_list<iter-value-type<InputIterator>, Allocator>;