std::experi...t::operator=(3)

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

🌸 std::experi...t::operator=(3) 🌸

okay bestie, welcome to std::experi...t::operator=(3), straight out of the C++ Standard Libary manual. This page is all about assignment for std::experimental::propagate_const, and the NAME is literally std::experimental::propagate_const::operator= β€” say it with me. πŸ’…

✨ NAME ✨

std::experimental::propagate_const::operator= β€” yep, that's the whole name, iconic and slightly mysterious.

πŸŒ€ Synopsis πŸŒ€

Here's the synopsis exactly as the page lays it out, bestie β€” don't let the line wrapping jump-scare you:

          constexpr propagate_const& operator=(               (1) (library
       fundamentals TS v2)
          propagate_const&& p ) = default;
          template< class U >
          constexpr propagate_const& operator=(               (2) (library
       fundamentals TS v2)
          propagate_const<U>&& pu );
          template< class U >                                 (3) (library
       fundamentals TS v2)
          constexpr propagate_const& operator=( U&& u );
          propagate_const& operator=( const propagate_const&  (4) (library
       fundamentals TS v2)
          ) = delete;

First, let t_ designate the private data member that is the wrapped pointer-like object. Got it? Good. Now the numbered lore:

  1. This one is an explicitly defaulted move assignment operator that move assigns this->t_ from p.t_.
  2. Assigns std::move(pu.t_) to this->t_. This overload participates in overload resolution only if U is implicitly convertible to T.
  3. Assigns std::forward<U>(u) to this->t_. This overload participates in overload resolution only if U is implicitly convertible to T and std::decay_t<U> is not a specialization of propagate_const.
  4. Copy assignment operator is explicitly deleted. propagate_const is non-copyable. No cap, no copying, periodt. πŸ’€

πŸŽ€ Parameters πŸŽ€

  • p β€” another propagate_const object to move from
  • pu β€” another propagate_const object of a different specialization to move from
  • u β€” another object to assign to the contained pointer

🫢 Return value 🫢

The return value is *this.


Sign-off time, bestie: this page's source/version is http://cppreference.com, dated 2024.06.10, and its page id is std::experi...t::operator=(3). Stay slaying πŸ’–βœ¨

πŸ“¦ where this page comes from