refactor: SymbolicConstant moved to _expression_template.h_

This commit is contained in:
Mateusz Pusz
2024-11-08 12:58:40 +01:00
parent 06853b7aeb
commit 1702853893
2 changed files with 15 additions and 7 deletions

View File

@@ -193,11 +193,4 @@ template<template<auto...> typename T, typename T1, typename T2, typename... Ts>
return get<T, T2, Ts...>(); return get<T, T2, Ts...>();
} }
namespace detail {
template<typename T>
concept SymbolicConstant = std::is_empty_v<T> && std::is_final_v<T>;
}
} // namespace mp_units } // namespace mp_units

View File

@@ -31,13 +31,28 @@
#ifdef MP_UNITS_IMPORT_STD #ifdef MP_UNITS_IMPORT_STD
import std; import std;
#else #else
#include <concepts>
#include <cstdint> #include <cstdint>
#include <functional> #include <functional>
#include <type_traits>
#endif #endif
#endif #endif
namespace mp_units { namespace mp_units {
namespace detail {
// `SymbolicArg` is provided because `SymbolicConstant` requires a complete type which is not the case
// for `OneType` below.
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>;
} // namespace detail
/** /**
* @brief Type list type used by the expression template framework * @brief Type list type used by the expression template framework
* *