GeezerVison is showing cpprefjp.github.io — std::operator+ - cpprefjp C++日本語リファレンス
最終更新日時:
2026年09月19日 21時31分51秒 (JST)
rotarymars
が更新
履歴
編集
function template
<string_view>
std:: operator+ (C++26)
namespace std {
template < class charT , class traits , class Allocator >
constexpr basic_string < charT , traits , Allocator >
operator + ( type_identity_t < basic_string_view < charT , traits >> lhs ,
const basic_string < charT , traits , Allocator >& rhs ); // (1) C++26
template < class charT , class traits , class Allocator >
constexpr basic_string < charT , traits , Allocator >
operator + ( type_identity_t < basic_string_view < charT , traits >> lhs ,
basic_string < charT , traits , Allocator >&& rhs ); // (2) C++26
}
概要
basic_string_view オブジェクトとbasic_string オブジェクトを連結する。
basic_string_view側の引数にtype_identity_t を使用することで非推論コンテキストとし、basic_string_viewに暗黙変換可能な型からの連結を可能にしている。
戻り値
(1) : 以下と等価
basic_string < charT , traits , Allocator > r = rhs ;
r . insert ( 0 , lhs );
return r ;
(2) : 以下と等価
rhs . insert ( 0 , lhs );
return std :: move ( rhs );
例
出力
Hello, World!
Hello, World!
バージョン
言語
処理系
関連項目
参照