std::error_...n::operator=(3)

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

πŸŽ€ std::error_...n::operator=(3) β€” from the C++ Standard Libary manual, bestie πŸŽ€

🌸 NAME 🌸

std::error_condition::operator= β€” literally std::error_condition::operator=. That’s the whole name, no cap πŸ’….

✨ Synopsis ✨

Okay so here’s the exact code vibe, bestie β€” overloads numbered (1), (2), (3), all since C++11:

template< class ErrorConditionEnum >
error_condition& operator=( ErrorConditionEnum e )         (1) (since
C++11)
noexcept;
error_condition& operator=( const error_condition& other ) (2) (since
C++11)
= default;
(implicitly declared)
error_condition& operator=( error_condition&& other ) =    (3) (since
C++11)
default;
(implicitly declared)

πŸ’– Description πŸ’–

Assigns contents to an error condition. That’s the main-character sentence, and here’s the breakdown:

  1. Assigns error condition for enum e. Effectively calls make_error_condition that is only found by argument-dependent lookup for e and then replaces *this with the result. This overload participates in overload resolution only if std::is_error_condition_enum<ErrorConditionEnum>::value is true.

2,3. Implicitly defined copy-assignment operator and move-assignment operator assign the contents of other to *this.

🫢 Parameters 🫢

  • e β€” error condition enum
  • other β€” another error condition to assign with

πŸ‘‘ Return value πŸ‘‘

Returns *this. Short, sweet, iconic ✨.

🩹 Defect reports 🩹

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

  • DR: LWG 3629
  • Applied to: C++11
  • Behavior as published: only std::make_error_condition overloads were used
  • Correct behavior: ADL-found overloads are used

πŸ’– source/version + date sign-off: this page came from http://cppreference.com, dated 2024.06.10, and it’s the std::error_...n::operator=(3) page. Mwah! πŸ’…

πŸ“¦ where this page comes from