blob: a6978fcc5b2754fe729a237361c93e9b8422644e (
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
|
/*
* File: basic_hash.hpp
* Author: Amlal El Mahrouss,
* Copyright 2023-2025, Amlal El Mahrouss, Licensed under the Boost Software License
*/
#ifndef __OCL_CORE_BASIC_HASH
#define __OCL_CORE_BASIC_HASH
#include <ocl/detail/config.hpp>
/// @brief OCL equivalence namespace.
namespace ocl
{
/// \brief Hash helper.
template <class T>
struct basic_hash
{
using result_type = typename T::result_type;
using type = T;
// AMLALE: If it throws, we can't compute the hash correctly.
constexpr result_type hash() noexcept
{
return type{}.hash();
}
};
/// \brief For all boolean types, return false as they are not hashable
template <>
struct basic_hash<bool>
{
using result_type = bool;
using type = bool;
// AMLALE: If it throws, we can't compute the hash correctly.
constexpr result_type hash()
{
return false;
}
};
} // namespace ocl
#endif
|