From Jason Turner

[string.assign]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvcqya0tb/{from.md → to.md} +108 -0
tmp/tmpvcqya0tb/{from.md → to.md} RENAMED
@@ -0,0 +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
+