21 Strings library [strings]

21.3 String classes [string.classes]

21.3.2 Class template basic_­string [basic.string]

21.3.2.6 Modifiers [string.modifiers]

21.3.2.6.2 basic_­string​::​append [string.append]

constexpr basic_string& append(const basic_string& str);
Effects: Equivalent to: return append(str.data(), str.size());
constexpr basic_string& append(const basic_string& str, size_type pos, size_type n = npos);
Effects: Equivalent to:
return append(basic_string_view<charT, traits>(str).substr(pos, n));
template<class T> constexpr basic_string& append(const T& t);
Constraints:
  • is_­convertible_­v<const T&, basic_­string_­view<charT, traits>> is true and
  • is_­convertible_­v<const T&, const charT*> is false.
Effects: Equivalent to:
basic_string_view<charT, traits> sv = t;
return append(sv.data(), sv.size());
template<class T> constexpr basic_string& append(const T& t, size_type pos, size_type n = npos);
Constraints:
  • is_­convertible_­v<const T&, basic_­string_­view<charT, traits>> is true and
  • is_­convertible_­v<const T&, const charT*> is false.
Effects: Equivalent to:
basic_string_view<charT, traits> sv = t;
return append(sv.substr(pos, n));
constexpr basic_string& append(const charT* s, size_type n);
Preconditions: [s, s + n) is a valid range.
Effects: Appends a copy of the range [s, s + n) to the string.
Returns: *this.
constexpr basic_string& append(const charT* s);
Effects: Equivalent to: return append(s, traits​::​length(s));
constexpr basic_string& append(size_type n, charT c);
Effects: Appends n copies of c to the string.
Returns: *this.
template<class InputIterator> constexpr basic_string& append(InputIterator first, InputIterator last);
Constraints: InputIterator is a type that qualifies as an input iterator ([container.requirements.general]).
Effects: Equivalent to: return append(basic_­string(first, last, get_­allocator()));
constexpr basic_string& append(initializer_list<charT> il);
Effects: Equivalent to: return append(il.begin(), il.size());
constexpr void push_back(charT c);
Effects: Equivalent to append(size_­type{1}, c).