190 lines
5.2 KiB
Markdown
190 lines
5.2 KiB
Markdown
[string.append]
|
||
|
||
# 27 Strings library [[strings]](./#strings)
|
||
|
||
## 27.4 String classes [[string.classes]](string.classes#string.append)
|
||
|
||
### 27.4.3 Class template basic_string [[basic.string]](basic.string#string.append)
|
||
|
||
#### 27.4.3.7 Modifiers [[string.modifiers]](string.modifiers#string.append)
|
||
|
||
#### 27.4.3.7.2 basic_string::append [string.append]
|
||
|
||
[ð](#lib:append,basic_string)
|
||
|
||
`constexpr basic_string& append(const basic_string& str);
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3254)
|
||
|
||
*Effects*: Equivalent to: return append(str.data(), str.size());
|
||
|
||
[ð](#lib:append,basic_string_)
|
||
|
||
`constexpr basic_string& append(const basic_string& str, size_type pos, size_type n = npos);
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3265)
|
||
|
||
*Effects*: Equivalent to:return append(basic_string_view<charT, traits>(str).substr(pos, n));
|
||
|
||
[ð](#lib:append,basic_string__)
|
||
|
||
`template<class T>
|
||
constexpr basic_string& append(const T& t);
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3280)
|
||
|
||
*Constraints*:
|
||
|
||
- [(3.1)](#3.1)
|
||
|
||
is_convertible_v<const T&, basic_string_view<charT, traits>> istrue and
|
||
|
||
- [(3.2)](#3.2)
|
||
|
||
is_convertible_v<const T&, const charT*> isfalse[.](#3.sentence-1)
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3291)
|
||
|
||
*Effects*: Equivalent to:basic_string_view<charT, traits> sv = t;return append(sv.data(), sv.size());
|
||
|
||
[ð](#lib:append,basic_string___)
|
||
|
||
`template<class T>
|
||
constexpr basic_string& append(const T& t, size_type pos, size_type n = npos);
|
||
`
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3307)
|
||
|
||
*Constraints*:
|
||
|
||
- [(5.1)](#5.1)
|
||
|
||
is_convertible_v<const T&, basic_string_view<charT, traits>> istrue and
|
||
|
||
- [(5.2)](#5.2)
|
||
|
||
is_convertible_v<const T&, const charT*> isfalse[.](#5.sentence-1)
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3318)
|
||
|
||
*Effects*: Equivalent to:basic_string_view<charT, traits> sv = t;return append(sv.substr(pos, n));
|
||
|
||
[ð](#lib:append,basic_string____)
|
||
|
||
`constexpr basic_string& append(const charT* s, size_type n);
|
||
`
|
||
|
||
[7](#7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3333)
|
||
|
||
*Preconditions*: [s, s + n) is a valid range[.](#7.sentence-1)
|
||
|
||
[8](#8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3337)
|
||
|
||
*Effects*: Appends a copy of the range [s, s + n) to the string[.](#8.sentence-1)
|
||
|
||
[9](#9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3341)
|
||
|
||
*Returns*: *this[.](#9.sentence-1)
|
||
|
||
[ð](#lib:append,basic_string_____)
|
||
|
||
`constexpr basic_string& append(const charT* s);
|
||
`
|
||
|
||
[10](#10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3352)
|
||
|
||
*Effects*: Equivalent to: return append(s, traits::length(s));
|
||
|
||
[ð](#lib:append,basic_string______)
|
||
|
||
`constexpr basic_string& append(size_type n, charT c);
|
||
`
|
||
|
||
[11](#11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3363)
|
||
|
||
*Effects*: Appends n copies of c to the string[.](#11.sentence-1)
|
||
|
||
[12](#12)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3367)
|
||
|
||
*Returns*: *this[.](#12.sentence-1)
|
||
|
||
[ð](#lib:append,basic_string_______)
|
||
|
||
`template<class InputIterator>
|
||
constexpr basic_string& append(InputIterator first, InputIterator last);
|
||
`
|
||
|
||
[13](#13)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3379)
|
||
|
||
*Constraints*: InputIterator is a type that qualifies as an input
|
||
iterator ([[container.reqmts]](container.reqmts "23.2.2.2 Container requirements"))[.](#13.sentence-1)
|
||
|
||
[14](#14)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3384)
|
||
|
||
*Effects*: Equivalent to: return append(basic_string(first, last, get_allocator()));
|
||
|
||
[ð](#lib:append_range,basic_string)
|
||
|
||
`template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1 Introduction [container.intro.reqmts]")<charT> R>
|
||
constexpr basic_string& append_range(R&& rg);
|
||
`
|
||
|
||
[15](#15)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3396)
|
||
|
||
*Effects*: Equivalent to: return append(basic_string(from_range, std::forward<R>(rg), get_allocator()));
|
||
|
||
[ð](#lib:append,basic_string________)
|
||
|
||
`constexpr basic_string& append(initializer_list<charT> il);
|
||
`
|
||
|
||
[16](#16)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3407)
|
||
|
||
*Effects*: Equivalent to: return append(il.begin(), il.size());
|
||
|
||
[ð](#lib:push_back,basic_string)
|
||
|
||
`constexpr void push_back(charT c);
|
||
`
|
||
|
||
[17](#17)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L3418)
|
||
|
||
*Effects*: Equivalent toappend(size_type{1}, c)[.](#17.sentence-1)
|