std::basic_string_view<CharT,Traits>::operator=
出自cppreference.com
< cpp | string | basic string view
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> 的公開成員函數)
|