From b98289eea6d44cb26ef778b7dae40ba34bd03404 Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu> Date: Tue, 9 Apr 2019 13:16:04 -0300 Subject: [PATCH] is_quantity<> utility --- ThirdParty/phys/units/quantity.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ThirdParty/phys/units/quantity.hpp b/ThirdParty/phys/units/quantity.hpp index 06fbb4b2c..970773d59 100644 --- a/ThirdParty/phys/units/quantity.hpp +++ b/ThirdParty/phys/units/quantity.hpp @@ -473,6 +473,16 @@ namespace phys { friend constexpr bool operator>=(quantity<D, X> const& x, quantity<D, Y> const& y); }; + // helper to check whether some type is a quantity + template <typename TNonQuantityType> + struct is_quantity : std::false_type {}; + + template <typename Dims, typename T> + struct is_quantity<quantity<Dims, T>> : std::true_type {}; + + template <typename T> + constexpr bool is_quantity_v = is_quantity<T>::value; + // Give names to the seven fundamental dimensions of physical reality. typedef dimensions<1, 0, 0, 0, 0, 0, 0, 0> length_d; -- GitLab