Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::error_code::operator=

      From cppreference.com
      <cpp‎ |error‎ |error code
       
       
      Utilities library
       
      Diagnostics library
       
       
      template<class ErrorCodeEnum>
      error_code& operator=( ErrorCodeEnum e)noexcept;
      (1)(since C++11)
      error_code& operator=(const error_code& other)=default;
      (2)(since C++11)
      (implicitly declared)
      error_code& operator=( error_code&& other)=default;
      (3)(since C++11)
      (implicitly declared)
      1) Replaces the error code and corresponding category with those representing error code enume.

      Equivalent to*this= make_error_code(e), wheremake_error_code is only found byargument-dependent lookup.

      This overload participates in overload resolution only ifstd::is_error_code_enum<ErrorCodeEnum>::value istrue.
      2,3) Implicitly defined copy-assignment operator and move-assignment operator assign the contents ofother to*this.

      Contents

      [edit]Parameters

      e - error code enum to construct
      other - another error code to assign with

      [edit]Return value

      *this

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 3629C++11onlystd::make_error_code overloads were usedADL-found overloads are used

      [edit]See also

      assigns another error code
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/error/error_code/operator%3D&oldid=168920"

      [8]ページ先頭

      ©2009-2025 Movatter.jp