From Jason Turner

[string.append]

Diff to HTML by rtfpessoa

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