upcastable class template added to provide the base class for upcastable classes
This commit is contained in:
1 parent
776c91cf64
commit
310541c9f1
4 files changed
+13
-12
No files matched your search
@@ -110,6 +110,13 @@ namespace units {
|
||||
template<Ratio Ratio1, Ratio Ratio2>
|
||||
using common_ratio_t = typename common_ratio<Ratio1, Ratio2>::type;
|
||||
|
||||
// upcastable
|
||||
|
||||
template<typename BaseType>
|
||||
struct upcastable {
|
||||
using base_type = BaseType;
|
||||
};
|
||||
|
||||
// upcasting_traits
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace units {
|
||||
struct exp_greater_equal : std::bool_constant<(E1::value >= E2::value)> {
|
||||
};
|
||||
|
||||
// exp_invert
|
||||
// exp_invert
|
||||
|
||||
template<Exponent E>
|
||||
struct exp_invert;
|
||||
@@ -87,9 +87,7 @@ namespace units {
|
||||
// dimension
|
||||
|
||||
template<Exponent... Es>
|
||||
struct dimension {
|
||||
using base_type = dimension<Es...>;
|
||||
};
|
||||
struct dimension : upcastable<dimension<Es...>> {};
|
||||
|
||||
// is_dimension
|
||||
namespace detail {
|
||||
|
||||
@@ -29,8 +29,7 @@ namespace units {
|
||||
|
||||
template<Dimension D, Ratio R>
|
||||
requires (R::num > 0)
|
||||
struct unit {
|
||||
using base_type = unit<D, R>;
|
||||
struct unit : upcastable<unit<D, R>> {
|
||||
using dimension = D;
|
||||
using ratio = R;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user