名前空間
変種
操作

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

From cppreference.com
 
 
 
 
constexpr basic_string_view& operator=( const basic_string_view& view ) noexcept = default;
(C++17以降)

ビューを view のものに置き換えます。

目次

[編集] パラメータ

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> のメンバ関数) [編集]
English 日本語 中文(简体) 中文(繁體)