refactor: Limited the equivalent trait usage

This commit is contained in:
Mateusz Pusz
2020-12-28 18:40:58 +01:00
parent c0197aec7d
commit 32391866be
3 changed files with 21 additions and 14 deletions
+8 -1
View File
@@ -25,7 +25,14 @@
#include "units/bits/equivalent.h"
template<typename T, typename U>
inline constexpr bool compare_impl = UNITS_DOWNCAST_MODE != 0 ? std::is_same_v<T, U> : (std::is_same_v<T, U> || units::equivalent<T, U>);
inline constexpr bool compare_impl = false;
template<typename T>
inline constexpr bool compare_impl<T, T> = true;
template<typename T, typename U>
requires (UNITS_DOWNCAST_MODE == 0)
inline constexpr bool compare_impl<T, U> = units::equivalent<T, U>;
template<typename T, typename U>
inline constexpr bool compare = compare_impl<std::remove_cvref_t<T>, std::remove_cvref_t<U>>;