Skip to content

Commit

Permalink
Explicitly declare and document copy constructor and assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
jasujm committed May 9, 2020
1 parent 24bf59f commit cd208ea
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion cxx/include/enhanced_enum/enhanced_enum.hh
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,31 @@ struct enum_base {
*/
enum_base() = default;

/** \brief Copy construct an enumerator
*
* Postcondition: <tt>this->get() == other.get()</tt>
*
* \param other The source enumerator
*/
constexpr enum_base(const enum_base& other) noexcept = default;

/** \brief Construct an enumerator with the given label
*
* Postcondition: <tt>this->get() == label</tt>.
*
* \param label The label enumerator
*/
constexpr enum_base(label_type label) noexcept : label {label} {}
constexpr enum_base(const label_type& label) noexcept : label {label} {}

/** \brief Copy assign an enumerator
*
* Postcondition: <tt>this->get() == other.get()</tt>
*
* \param other The source enumerator
*
* \return \c *this
*/
constexpr enum_base& operator=(const enum_base& other) noexcept = default;

/** \brief Return the label enumerator
*/
Expand Down

0 comments on commit cd208ea

Please sign in to comment.