summaryrefslogtreecommitdiffhomepage
path: root/include/ocl/equiv.hpp
blob: 53299dc51f7c3b8d84bc258efecf711fc5284886 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2023-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Official repository: https://github.com/ocl-foss-org/core

#ifndef OCL_CORE_EQUIV
#define OCL_CORE_EQUIV

#include <ocl/detail/config.hpp>

/// @brief OCL equivalence namespace.
namespace ocl
{

	template <typename T>
	struct is_real final
	{
		using type					= T;
		static constexpr auto value = false;
	};

	template <typename L, typename R>
	struct equiv_to final
	{
		using left_type	 = L;
		using right_type = R;

		static constexpr auto value = false;
	};

	template <typename L>
	struct equiv_to<L, L> final
	{
		static constexpr auto value = true;
	};

	template <>
	struct is_real<double> final
	{
		static constexpr auto value = true;
	};

	template <>
	struct is_real<float> final
	{
		static constexpr auto value = true;
	};

	/// \brief alias equiv_to to boolean type.
	template <typename T>
	using equiv_to_bool = equiv_to<bool, T>;

} // namespace ocl

#endif