Inheritance hierarchy helpers for dimension and unit made more descriptive

This commit is contained in:
Mateusz Pusz committed 2018-11-15 05:29:01 +01:00
1 parent db64a3e6a1
commit 58e1eefd3b
6 files changed
+35 -32

No files matched your search

+4 -3
View File
@@ -28,7 +28,8 @@
namespace units {
template<Dimension D, Ratio R>
struct unit : std::type_identity<unit<D, R>> {
struct unit {
using base_type = unit<D, R>;
using dimension = D;
using ratio = R;
static_assert(ratio::num > 0, "ratio must be positive");
@@ -49,8 +50,8 @@ namespace units {
template<typename T>
concept bool Unit =
std::is_empty_v<T> &&
detail::is_unit<typename T::type> &&
DerivedFrom<T, typename T::type>;
detail::is_unit<typename T::base_type> &&
DerivedFrom<T, typename T::base_type>;
// dimension_traits