mirror of
https://github.com/mpusz/mp-units.git
synced 2025-06-25 01:01:33 +02:00
@ -48,9 +48,11 @@ template<typename T>
|
||||
concept SymbolicArg = (!std::is_const_v<T>) && (!std::is_reference_v<T>);
|
||||
|
||||
template<typename T>
|
||||
concept SymbolicConstant =
|
||||
SymbolicArg<T> && std::is_empty_v<T> && std::is_trivial_v<T> && std::semiregular<T> && std::is_final_v<T>;
|
||||
|
||||
concept SymbolicConstant = SymbolicArg<T> && std::is_empty_v<T> && std::is_trivial_v<T> &&
|
||||
#if !MP_UNITS_COMP_GCC || MP_UNITS_COMP_GCC > 12
|
||||
std::semiregular<T> &&
|
||||
#endif
|
||||
std::is_final_v<T>;
|
||||
|
||||
/**
|
||||
* @brief Type list type used by the expression template framework
|
||||
|
@ -117,8 +117,8 @@ concept ChildQuantitySpecOf = (is_child_of(Child, Parent));
|
||||
|
||||
template<auto To, auto From>
|
||||
concept NestedQuantityKindSpecOf =
|
||||
QuantitySpec<decltype(From)> && QuantitySpec<decltype(To)> && (!SameQuantitySpec<get_kind(From), get_kind(To)>) &&
|
||||
ChildQuantitySpecOf<To, get_kind(From)._quantity_spec_>;
|
||||
QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(From))> && QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(To))> &&
|
||||
(!SameQuantitySpec<get_kind(From), get_kind(To)>) && ChildQuantitySpecOf<To, get_kind(From)._quantity_spec_>;
|
||||
|
||||
template<auto From, auto To>
|
||||
concept QuantitySpecConvertibleTo =
|
||||
|
@ -86,7 +86,7 @@ static_assert(!std::convertible_to<min_impl<double>, quantity<si::metre, min_imp
|
||||
|
||||
// multiply syntax should work
|
||||
template<typename T, auto U>
|
||||
concept creates_quantity = Unit<decltype(U)> && requires { T{} * U; };
|
||||
concept creates_quantity = Unit<MP_UNITS_REMOVE_CONST(decltype(U))> && requires { T{} * U; };
|
||||
|
||||
static_assert(creates_quantity<min_impl<int>, si::metre>);
|
||||
static_assert(creates_quantity<min_impl<double>, si::metre>);
|
||||
|
@ -61,7 +61,8 @@ static_assert(1 * Qm == 1'000'000'000'000'000'000 * Tm);
|
||||
|
||||
// check for invalid prefixes
|
||||
template<template<typename U> typename prefix, auto V1>
|
||||
concept can_not_be_prefixed = Unit<decltype(V1)> && !requires { typename prefix<decltype(V1)>; };
|
||||
concept can_not_be_prefixed =
|
||||
Unit<MP_UNITS_REMOVE_CONST(decltype(V1))> && !requires { typename prefix<MP_UNITS_REMOVE_CONST(decltype(V1))>; };
|
||||
|
||||
static_assert(can_not_be_prefixed<si::milli_, si::kilogram>);
|
||||
static_assert(can_not_be_prefixed<si::milli_, si::hectare>);
|
||||
|
Reference in New Issue
Block a user