std::basic_...w::operator=(3)
π NAME π
Okay so welcome to std::basic_...w::operator=(3), bestie β this page lives in the C++ Standard Libary manual (yes, that spelling is literally in the header π
).
std::basic_string_view::operator= β and the NAME line is also std::basic_string_view::operator=, because she's not subtle, she's an assignment operator. Periodt. β¨
β¨ Synopsis β¨
constexpr basic_string_view& operator=( const basic_string_view& view
(since C++17)
) noexcept = default;
It replaces the view with that of view. That's the whole vibe. π«Ά
πΈ Parameters πΈ
viewβ view to copy. Literally the view you're copying, bestie. π
π« Return value π«
*thisβ she returns herself. Main character energy only. π
β‘ Complexity β‘
Constant. No cap, constant. β‘
π Example π
// Run this code
#include <iostream>
#include <string_view>
int main()
{
std::string_view v = "Hello, world";
v = v.substr(7);
std::cout << v << '\n';
}
π Output π
world
π See also π
- constructor β constructs a
basic_string_view(public member function) - operator= β assigns values to the string (public member function of
std::basic_string<CharT,Traits,Allocator>)
kisses bestie π«Ά source: http://cppreference.com Β· version/date: 2024.06.10 Β· footer title: std::basic_...w::operator=(3) β iconic, honestly. π¦
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms