命名空间
变体
操作

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

来自 cppreference.cn
 
 
 
 
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> 的公共成员函数) [编辑]