std::string operator+=
- od C++20
- od C++17
- od C++11
- do C++11
// (1) Non const version only
constexpr basic_string& operator+=( const basic_string& str );
// (2) Non const version only
constexpr basic_string& operator+=( CharT ch );
// (3) Non const version only
constexpr basic_string& operator+=( const CharT* s );
// (4) Non const version only
constexpr basic_string& operator+=( std::initializer_list<CharT> ilist );
// (5) Non const version only
template < class StringViewLike >
constexpr basic_string& operator+=( const StringViewLike& t );
// (1) Non const version only
basic_string& operator+=( const basic_string& str );
// (2) Non const version only
basic_string& operator+=( CharT ch );
// (3) Non const version only
basic_string& operator+=( const CharT* s );
// (4) Non const version only
basic_string& operator+=( std::initializer_list<CharT> ilist );
// (5) Non const version only
template < class StringViewLike >
basic_string& operator+=( const StringViewLike& t );
// (1) Non const version only
basic_string& operator+=( const basic_string& str );
// (2) Non const version only
basic_string& operator+=( CharT ch );
// (3) Non const version only
basic_string& operator+=( const CharT* s );
// (4) Non const version only
basic_string& operator+=( std::initializer_list<CharT> ilist );
// (1) Non const version only
basic_string& operator+=( const basic_string& str );
// (2) Non const version only
basic_string& operator+=( CharT ch );
// (3) Non const version only
basic_string& operator+=( const CharT* s );
Appends additional characters to the string.
- (1) Appends string
str
. - (2) Appends character
ch
. - (3) Appends the null-terminated character string pointed to by
s
. - (4) Appends characters in the initializer list
ilist
. - (5) Implicitly converts
t
to a string viewsv
as if bystd::basic_string_view<CharT, Traits> sv = t;
, then appends characters in the string viewsv
as if byappend(sv)
.Overload ResolutionThis overload participates in overload resolution only if
std::is_convertible_v<const StringViewLike&, std::basic_string_view<CharT, Traits>>
istrue
andstd::is_convertible_v<const StringViewLike&, const CharT*>
isfalse
.
Parameters
str
- string to appendch
- character value to appends
- pointer to a null-terminated character string to appendilist
-std::initializer_list
with the characters to appendt
- object (convertible tostd::basic_string_view
) with the characters to append