std::basic_...w::operator=(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– 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