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

出自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
(公開成員函數) [編輯]
為字符串賦值
(std::basic_string<CharT,Traits,Allocator> 的公開成員函數) [編輯]