From 1702853893aa8b699d59e99bd73969c9a8360437 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 8 Nov 2024 12:58:40 +0100 Subject: [PATCH] refactor: `SymbolicConstant` moved to _expression_template.h_ --- src/core/include/mp-units/ext/type_traits.h | 7 ------- .../mp-units/framework/expression_template.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/core/include/mp-units/ext/type_traits.h b/src/core/include/mp-units/ext/type_traits.h index 70b9523c..119a27c5 100644 --- a/src/core/include/mp-units/ext/type_traits.h +++ b/src/core/include/mp-units/ext/type_traits.h @@ -193,11 +193,4 @@ template typename T, typename T1, typename T2, typename... Ts> return get(); } -namespace detail { - -template -concept SymbolicConstant = std::is_empty_v && std::is_final_v; - -} - } // namespace mp_units diff --git a/src/core/include/mp-units/framework/expression_template.h b/src/core/include/mp-units/framework/expression_template.h index 17e40512..4514edd9 100644 --- a/src/core/include/mp-units/framework/expression_template.h +++ b/src/core/include/mp-units/framework/expression_template.h @@ -31,13 +31,28 @@ #ifdef MP_UNITS_IMPORT_STD import std; #else +#include #include #include +#include #endif #endif namespace mp_units { +namespace detail { + +// `SymbolicArg` is provided because `SymbolicConstant` requires a complete type which is not the case +// for `OneType` below. +template +concept SymbolicArg = (!std::is_const_v) && (!std::is_reference_v); + +template +concept SymbolicConstant = + SymbolicArg && std::is_empty_v && std::is_trivial_v && std::semiregular && std::is_final_v; + +} // namespace detail + /** * @brief Type list type used by the expression template framework *