Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::experimental::any::operator=

      From cppreference.com
      <cpp‎ |experimental‎ |any
       
       
       
       
       
      any& operator=(const any& rhs);
      (1)(library fundamentals TS)
      any& operator=( any&& rhs)noexcept;
      (2)(library fundamentals TS)
      template<typename ValueType>
          any& operator=( ValueType&& rhs);
      (3)(library fundamentals TS)

      Assigns contents to the contained value.

      1) Assigns by copying the state ofrhs, as if byany(rhs).swap(*this).
      2) Assigns by moving the state ofrhs, as if byany(std::move(rhs)).swap(*this).rhs is left in a valid but unspecified state after the assignment.
      3) Assigns the type and value ofrhs, as if byany(std::forward<ValueType>(rhs)).swap(*this). Ifstd::is_copy_constructible<std::decay_t<ValueType>>::value isfalse, the program is ill-formed. This overload participates in overload resolution only ifstd::decay_t<ValueType> is not the same type asany.

      Contents

      [edit]Template parameters

      ValueType - contained value type
      Type requirements
      -
      std::decay_t<ValueType> must meet the requirements ofCopyConstructible.

      [edit]Parameters

      rhs - object whose contained value to assign

      [edit]Return value

      *this

      [edit]Exceptions

      1,3) Throwsbad_alloc or any exception thrown by the constructor of the contained type. If an exception is thrown, there are no effects (strong exception guarantee).

      [edit]See also

      constructs anany object
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/any/operator%3D&oldid=160528"

      [8]ページ先頭

      ©2009-2025 Movatter.jp