diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-11 09:47:13 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-11 09:47:31 +0100 |
| commit | 881039cd402fc24c43659c9727f89cffce0469fe (patch) | |
| tree | 7caf7d6f4a260b08cffeab9da3893e0c2213aa19 /include/ocl/is_same.hpp | |
| parent | c62d8578cc50f20fe65624afdf642c1763b3547d (diff) | |
chore: API cleanup and improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/ocl/is_same.hpp')
| -rw-r--r-- | include/ocl/is_same.hpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/include/ocl/is_same.hpp b/include/ocl/is_same.hpp index ec3eb66..2ad6db5 100644 --- a/include/ocl/is_same.hpp +++ b/include/ocl/is_same.hpp @@ -14,7 +14,7 @@ namespace ocl { template <typename T> - struct basic_hash + struct basic_hash final { using result_type = typename T::result_type; using type = T; @@ -29,13 +29,10 @@ namespace ocl template <typename T, typename U> struct is_same { - static constexpr bool value = false; + using left_type = T; + using right_type = T; - /// @brief check if hash matches what we expect. - constexpr bool operator()() noexcept - { - return T::hash() == U::hash(); - } + static constexpr bool value = false; }; template <typename T> @@ -47,12 +44,10 @@ namespace ocl template <typename T, typename U> struct is_not_same { - static constexpr bool value = true; + using left_type = T; + using right_type = T; - constexpr bool operator()() noexcept - { - return T::hash() != U::hash(); - } + static constexpr bool value = true; }; template <typename T> @@ -62,7 +57,7 @@ namespace ocl }; template <typename T> - struct equiv_is_int8 + struct equiv_is_int8 final { private: T left_ = 127, right_ = 127; @@ -77,7 +72,7 @@ namespace ocl }; template <typename T> - struct equiv_not_int8 + struct equiv_not_int8 final { private: // these shall overflow if not int8. @@ -93,7 +88,7 @@ namespace ocl }; template <typename T> - struct equiv_is_real + struct equiv_is_real final { private: T left_ = 5, right_ = 3; @@ -108,17 +103,18 @@ namespace ocl }; template <typename T> - struct equiv_is + struct equiv_is final { private: T left_{}, right_{}; public: using result_type = bool; + using type = T; constexpr result_type hash() { - return (left_ / right_); + return (left_ == right_); } }; } // namespace ocl |
