Namespaces
Variants

std::basic_string_view<CharT,Traits>::operator=

ja.cppreference.net より
 
 
 
 
constexpr basic_string_view& operator=( const basic_string_view& view ) noexcept = default;
(C++17以上)

ビューを view のビューで置き換える。

パラメータ

ビュー - コピー対象のビュー

戻り値

* this

計算量

定数。

例

#include <iostream>
#include <string_view>
int main()
{
    std::string_view v = "Hello, world";
    v = v.substr(7);
    std::cout << v << '\n';
}

出力:

world

関連項目

basic_string_viewを構築する
(public member function)
文字列に値を代入する
(std::basic_string<CharT,Traits,Allocator>の public member function)