diff --git a/src/t8_types/t8_type.hxx b/src/t8_types/t8_type.hxx index 021ce62af4..29b21e6c94 100644 --- a/src/t8_types/t8_type.hxx +++ b/src/t8_types/t8_type.hxx @@ -36,7 +36,7 @@ * This class template allows the creation of a type that can be extended with * multiple competences. Each competence is a template class that takes the * main type as a template parameter. - * + * * This is heavily inspired by (and taken from) https://www.fluentcpp.com/2016/12/08/strong-types-for-strong-interfaces/ * * \tparam T The type of the value to be stored. @@ -59,16 +59,14 @@ class T8Type: public competence>... { /** * Construct a new T8Type object - * - * \tparam T_ref - * \param value - * - * \note This constructor is only enabled if T is not a reference. + * + * \param value + * + * \note This constructor is only enabled if T is not a reference value. */ - template - explicit constexpr T8Type (T&& value, - typename std::enable_if {}, std::nullptr_t>::type = nullptr) - : value_ (std::move (value)) + explicit constexpr T8Type (T&& value) + requires (!std::is_reference_v) + : value_ (std::forward (value)) { } @@ -99,13 +97,13 @@ class T8Type: public competence>... { constexpr T const& get () const noexcept { - return std::move (value_); + return value_; } /** Implicit conversion to value type * to cast a variable instance of this class into its * value_type for example for printing. - * + * * \note to future devs: If this causes trouble in the future when we create a * type that is not easily (or should not be) convertible to its base type, * we can wrap this inside an enable_if condition and only allow the conversion