std::string_view operator=
- since C++17
// Non const version only
constexpr basic_string_view& operator=( const basic_string_view& view ) noexcept = default;
Replaces the view with that of view
.
Parameters
view
- view to copy
Return value
*this
Complexity
Constant - O(1).
Exceptions
(none)
Example
Main.cpp
#include <iostream>
#include <string_view>
int main()
{
std::string_view v = "Hello, world";
v = v.substr(7);
std::cout << v << '\n';
}
Output
world
This article originates from this CppReference page. It was likely altered for improvements or editors' preference. Click "Edit this page" to see all changes made to this document.
Hover to see the original license.
Hover to see the original license.