From Jason Turner

[string.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmppqg9full/{from.md → to.md} +29 -5
tmp/tmppqg9full/{from.md → to.md} RENAMED
@@ -20,17 +20,33 @@ state.
20
  ``` cpp
21
  constexpr basic_string(const basic_string& str, size_type pos,
22
  const Allocator& a = Allocator());
23
  constexpr basic_string(const basic_string& str, size_type pos, size_type n,
24
  const Allocator& a = Allocator());
 
 
 
 
25
  ```
26
 
27
- *Effects:* Let `n` be `npos` for the first overload. Equivalent to:
28
 
29
- ``` cpp
30
- basic_string(basic_string_view<charT, traits>(str).substr(pos, n), a)
31
- ```
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  ``` cpp
34
  template<class T>
35
  constexpr basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator());
36
  ```
@@ -105,11 +121,19 @@ template<class InputIterator>
105
 
106
  *Constraints:* `InputIterator` is a type that qualifies as an input
107
  iterator [[container.requirements.general]].
108
 
109
  *Effects:* Constructs a string from the values in the range \[`begin`,
110
- `end`), as indicated in [[container.seq.req]].
 
 
 
 
 
 
 
 
111
 
112
  ``` cpp
113
  constexpr basic_string(initializer_list<charT> il, const Allocator& a = Allocator());
114
  ```
115
 
 
20
  ``` cpp
21
  constexpr basic_string(const basic_string& str, size_type pos,
22
  const Allocator& a = Allocator());
23
  constexpr basic_string(const basic_string& str, size_type pos, size_type n,
24
  const Allocator& a = Allocator());
25
+ constexpr basic_string(basic_string&& str, size_type pos,
26
+ const Allocator& a = Allocator());
27
+ constexpr basic_string(basic_string&& str, size_type pos, size_type n,
28
+ const Allocator& a = Allocator());
29
  ```
30
 
31
+ Let
32
 
33
+ - `s` be the value of `str` prior to this call and
34
+ - `rlen` be `pos + min(n, s.size() - pos)` for the overloads with
35
+ parameter `n`, and `s.size()` otherwise.
36
+
37
+ *Effects:* Constructs an object whose initial value is the range
38
+ \[`s.data() + pos`, `s.data() + rlen`).
39
+
40
+ *Throws:* `out_of_range` if `pos > s.size()`.
41
+
42
+ *Remarks:* For the overloads with a `basic_string&&` parameter, `str` is
43
+ left in a valid but unspecified state.
44
+
45
+ *Recommended practice:* For the overloads with a `basic_string&&`
46
+ parameter, implementations should avoid allocation if
47
+ `s.get_allocator() == a` is `true`.
48
 
49
  ``` cpp
50
  template<class T>
51
  constexpr basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator());
52
  ```
 
121
 
122
  *Constraints:* `InputIterator` is a type that qualifies as an input
123
  iterator [[container.requirements.general]].
124
 
125
  *Effects:* Constructs a string from the values in the range \[`begin`,
126
+ `end`), as specified in [[sequence.reqmts]].
127
+
128
+ ``` cpp
129
+ template<container-compatible-range<charT> R>
130
+ constexpr basic_string(from_range_t, R&& rg, const Allocator& = Allocator());
131
+ ```
132
+
133
+ *Effects:* Constructs a string from the values in the range `rg`, as
134
+ specified in [[sequence.reqmts]].
135
 
136
  ``` cpp
137
  constexpr basic_string(initializer_list<charT> il, const Allocator& a = Allocator());
138
  ```
139