std::basic_string_view<CharT,Traits>::operator=
来自 zh.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
(公开成员函数) |
|
|
为字符串赋值
(
std::basic_string<CharT,Traits,Allocator>
的公开成员函数)
|