aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/newtype/new_type.hpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/include/newtype/new_type.hpp b/include/newtype/new_type.hpp
index 9c1074c..4d8ad66 100644
--- a/include/newtype/new_type.hpp
+++ b/include/newtype/new_type.hpp
@@ -36,7 +36,15 @@ namespace nt
{
}
- protected:
+ /**
+ * Retrieve the base type value contained in this @p new_type
+ */
+ auto constexpr decay() const noexcept -> BaseType
+ {
+ return m_value;
+ }
+
+ private:
BaseType m_value{};
};
@@ -64,7 +72,15 @@ namespace nt
{
}
- protected:
+ /**
+ * Retrieve the base type value contained in this @p new_type
+ */
+ auto constexpr decay() const noexcept -> BaseType
+ {
+ return m_value;
+ }
+
+ private:
BaseType m_value;
};
@@ -87,14 +103,6 @@ namespace nt
public:
/**
- * Retrieve the base type value contained in this @p new_type
- */
- auto constexpr decay() const noexcept -> BaseType
- {
- return this->m_value;
- }
-
- /**
* Convert this instance into the equivalent base type value
*
* @note This overload participates only in overload resolution if the derication clause of this @p new_type contains
@@ -103,7 +111,7 @@ namespace nt
template<typename NewType = new_type, std::enable_if_t<NewType::derivations(nt::ImplicitConversion)> * = nullptr>
constexpr operator base_type() const noexcept(std::is_nothrow_copy_constructible_v<base_type>)
{
- return decay();
+ return this->decay();
}
/**
@@ -115,10 +123,10 @@ namespace nt
template<typename NewType = new_type, std::enable_if_t<!NewType::derivations(nt::ImplicitConversion)> * = nullptr>
explicit constexpr operator base_type() const noexcept(std::is_nothrow_copy_constructible_v<base_type>)
{
- return decay();
+ return this->decay();
}
};
} // namespace nt
-#endif \ No newline at end of file
+#endif