Skip to content

Commit

Permalink
fix: alternative implementation for IsOfCharacter
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz authored Nov 16, 2024
1 parent e1994b2 commit 4ec7761
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/core/include/mp-units/framework/representation_concepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,18 @@ template<typename T>
concept Tensor = is_tensor<T>;

template<typename T, quantity_character Ch>
constexpr bool IsOfCharacterImpl =
(Ch == quantity_character::scalar && is_scalar<T>) || (Ch == quantity_character::complex && is_complex<T>) ||
(Ch == quantity_character::vector && is_vector<T>) || (Ch == quantity_character::tensor && is_tensor<T>);
constexpr bool is_of_character_impl = false;
template<typename T>
constexpr bool is_of_character_impl<T, quantity_character::scalar> = is_scalar<T>;
template<typename T>
constexpr bool is_of_character_impl<T, quantity_character::complex> = is_complex<T>;
template<typename T>
constexpr bool is_of_character_impl<T, quantity_character::vector> = is_vector<T>;
template<typename T>
constexpr bool is_of_character_impl<T, quantity_character::tensor> = is_tensor<T>;

template<typename T, quantity_character Ch>
concept IsOfCharacter = IsOfCharacterImpl<T, Ch>;
concept IsOfCharacter = is_of_character_impl<T, Ch>;

template<typename T>
using scaling_factor_type_t = conditional<treat_as_floating_point<T>, long double, std::intmax_t>;
Expand Down

0 comments on commit 4ec7761

Please sign in to comment.