From Jason Turner

[string.assign]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpowj3r97n/{from.md → to.md} +51 -51
tmp/tmpowj3r97n/{from.md → to.md} RENAMED
@@ -1,108 +1,108 @@
1
  ##### `basic_string::assign` <a id="string.assign">[[string.assign]]</a>
2
 
3
  ``` cpp
4
- basic_string& assign(const basic_string& str);
5
  ```
6
 
7
- *Effects:* Equivalent to `*this = str`.
8
-
9
- *Returns:* `*this`.
10
 
11
  ``` cpp
12
- basic_string& assign(basic_string&& str)
13
  noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
14
  allocator_traits<Allocator>::is_always_equal::value);
15
  ```
16
 
17
- *Effects:* Equivalent to `*this = std::move(str)`.
18
-
19
- *Returns:* `*this`.
20
 
21
  ``` cpp
22
- basic_string&
23
- assign(const basic_string& str, size_type pos,
24
- size_type n = npos);
25
  ```
26
 
27
- *Throws:* `out_of_range` if `pos > str.size()`.
28
-
29
- *Effects:* Determines the effective length `rlen` of the string to
30
- assign as the smaller of `n` and `str``.size() - ``pos` and calls
31
- `assign(str.data() + pos, rlen)`.
32
-
33
- *Returns:* `*this`.
34
 
35
  ``` cpp
36
- basic_string& assign(basic_string_view<charT, traits> sv);
37
  ```
38
 
39
- *Effects:* Equivalent to: `return assign(sv.data(), sv.size());`
40
-
41
  ``` cpp
42
  template<class T>
43
- basic_string& assign(const T& t, size_type pos, size_type n = npos);
44
  ```
45
 
46
- *Throws:* `out_of_range` if `pos > sv.size()`.
47
 
48
- *Effects:* Creates a variable, `sv`, as if by
49
- `basic_string_view<charT, traits> sv = t`. Determines the effective
50
- length `rlen` of the string to assign as the smaller of `n` and
51
- `sv.size() - pos` and calls `assign(sv.data() + pos, rlen)`.
52
 
53
- *Remarks:* This function shall not participate in overload resolution
54
- unless `is_convertible_v<const T&, basic_string_view<charT, traits>>` is
55
- `true` and `is_convertible_v<const T&, const charT*>` is `false`.
56
 
57
- *Returns:* `*this`.
 
 
 
58
 
59
  ``` cpp
60
- basic_string& assign(const charT* s, size_type n);
 
61
  ```
62
 
63
- *Requires:* `s` points to an array of at least `n` elements of `charT`.
64
 
65
- *Throws:* `length_error` if `n > max_size()`.
 
 
66
 
67
- *Effects:* Replaces the string controlled by `*this` with a string of
68
- length `n` whose elements are a copy of those pointed to by `s`.
69
 
70
- *Returns:* `*this`.
 
 
 
71
 
72
  ``` cpp
73
- basic_string& assign(const charT* s);
74
  ```
75
 
76
- *Requires:* `s` points to an array of at least `traits::length(s) + 1`
77
- elements of `charT`.
78
 
79
- *Effects:* Calls `assign(s, traits::length(s))`.
 
80
 
81
  *Returns:* `*this`.
82
 
83
  ``` cpp
84
- basic_string& assign(initializer_list<charT> il);
85
  ```
86
 
87
- *Effects:* Calls `assign(il.begin(), il.size())`.
88
 
89
- `*this`.
 
 
 
 
90
 
91
  ``` cpp
92
- basic_string& assign(size_type n, charT c);
93
  ```
94
 
95
- *Effects:* Equivalent to `assign(basic_string(n, c))`.
96
 
97
- *Returns:* `*this`.
 
 
 
 
98
 
99
  ``` cpp
100
  template<class InputIterator>
101
- basic_string& assign(InputIterator first, InputIterator last);
102
  ```
103
 
104
- *Effects:* Equivalent to
105
- `assign(basic_string(first, last, get_allocator()))`.
106
 
107
- *Returns:* `*this`.
 
108
 
 
1
  ##### `basic_string::assign` <a id="string.assign">[[string.assign]]</a>
2
 
3
  ``` cpp
4
+ constexpr basic_string& assign(const basic_string& str);
5
  ```
6
 
7
+ *Effects:* Equivalent to: `return *this = str;`
 
 
8
 
9
  ``` cpp
10
+ constexpr basic_string& assign(basic_string&& str)
11
  noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
12
  allocator_traits<Allocator>::is_always_equal::value);
13
  ```
14
 
15
+ *Effects:* Equivalent to: `return *this = std::move(str);`
 
 
16
 
17
  ``` cpp
18
+ constexpr basic_string& assign(const basic_string& str, size_type pos, size_type n = npos);
 
 
19
  ```
20
 
21
+ *Effects:* Equivalent to:
 
 
 
 
 
 
22
 
23
  ``` cpp
24
+ return assign(basic_string_view<charT, traits>(str).substr(pos, n));
25
  ```
26
 
 
 
27
  ``` cpp
28
  template<class T>
29
+ constexpr basic_string& assign(const T& t);
30
  ```
31
 
32
+ *Constraints:*
33
 
34
+ - `is_convertible_v<const T&, basic_string_view<charT, traits>>` is
35
+ `true` and
36
+ - `is_convertible_v<const T&, const charT*>` is `false`.
 
37
 
38
+ *Effects:* Equivalent to:
 
 
39
 
40
+ ``` cpp
41
+ basic_string_view<charT, traits> sv = t;
42
+ return assign(sv.data(), sv.size());
43
+ ```
44
 
45
  ``` cpp
46
+ template<class T>
47
+ constexpr basic_string& assign(const T& t, size_type pos, size_type n = npos);
48
  ```
49
 
50
+ *Constraints:*
51
 
52
+ - `is_convertible_v<const T&, basic_string_view<charT, traits>>` is
53
+ `true` and
54
+ - `is_convertible_v<const T&, const charT*>` is `false`.
55
 
56
+ *Effects:* Equivalent to:
 
57
 
58
+ ``` cpp
59
+ basic_string_view<charT, traits> sv = t;
60
+ return assign(sv.substr(pos, n));
61
+ ```
62
 
63
  ``` cpp
64
+ constexpr basic_string& assign(const charT* s, size_type n);
65
  ```
66
 
67
+ *Preconditions:* \[`s`, `s + n`) is a valid range.
 
68
 
69
+ *Effects:* Replaces the string controlled by `*this` with a copy of the
70
+ range \[`s`, `s + n`).
71
 
72
  *Returns:* `*this`.
73
 
74
  ``` cpp
75
+ constexpr basic_string& assign(const charT* s);
76
  ```
77
 
78
+ *Effects:* Equivalent to: `return assign(s, traits::length(s));`
79
 
80
+ ``` cpp
81
+ constexpr basic_string& assign(initializer_list<charT> il);
82
+ ```
83
+
84
+ *Effects:* Equivalent to: `return assign(il.begin(), il.size());`
85
 
86
  ``` cpp
87
+ constexpr basic_string& assign(size_type n, charT c);
88
  ```
89
 
90
+ *Effects:* Equivalent to:
91
 
92
+ ``` cpp
93
+ clear();
94
+ resize(n, c);
95
+ return *this;
96
+ ```
97
 
98
  ``` cpp
99
  template<class InputIterator>
100
+ constexpr basic_string& assign(InputIterator first, InputIterator last);
101
  ```
102
 
103
+ *Constraints:* `InputIterator` is a type that qualifies as an input
104
+ iterator [[container.requirements.general]].
105
 
106
+ *Effects:* Equivalent to:
107
+ `return assign(basic_string(first, last, get_allocator()));`
108