24 Strings library [strings]

24.3 String classes [string.classes]

24.3.3 basic_­string non-member functions [string.nonmembers]

24.3.3.1 operator+ [string.op+]

template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(const basic_string<charT, traits, Allocator>& lhs, const basic_string<charT, traits, Allocator>& rhs);
Returns: basic_­string<charT, traits, Allocator>(lhs).append(rhs).
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(basic_string<charT, traits, Allocator>&& lhs, const basic_string<charT, traits, Allocator>& rhs);
Returns: std​::​move(lhs.append(rhs)).
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(const basic_string<charT, traits, Allocator>& lhs, basic_string<charT, traits, Allocator>&& rhs);
Returns: std​::​move(rhs.insert(0, lhs)).
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(basic_string<charT, traits, Allocator>&& lhs, basic_string<charT, traits, Allocator>&& rhs);
Returns: std​::​move(lhs.append(rhs)).
[ Note
:
Or equivalently, std​::​move(rhs.insert(0, lhs)).
— end note
 ]
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs);
Returns: basic_­string<charT, traits, Allocator>(lhs) + rhs.
Remarks: Uses traits​::​length().
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(const charT* lhs, basic_string<charT, traits, Allocator>&& rhs);
Returns: std​::​move(rhs.insert(0, lhs)).
Remarks: Uses traits​::​length().
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(charT lhs, const basic_string<charT, traits, Allocator>& rhs);
Returns: basic_­string<charT, traits, Allocator>(1, lhs) + rhs.
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(charT lhs, basic_string<charT, traits, Allocator>&& rhs);
Returns: std​::​move(rhs.insert(0, 1, lhs)).
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs);
Returns: lhs + basic_­string<charT, traits, Allocator>(rhs).
Remarks: Uses traits​::​length().
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(basic_string<charT, traits, Allocator>&& lhs, const charT* rhs);
Returns: std​::​move(lhs.append(rhs)).
Remarks: Uses traits​::​length().
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs);
Returns: lhs + basic_­string<charT, traits, Allocator>(1, rhs).
template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(basic_string<charT, traits, Allocator>&& lhs, charT rhs);
Returns: std​::​move(lhs.append(1, rhs)).