summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-22 08:00:32 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-22 08:01:51 +0100
commit11c218683eccb6cd5166aa8dcb8a051b421b0b40 (patch)
tree9bc4c76b54fbdcb54f53540301588ba46aa32c66 /include
parentcd5f71ead79201619a651a6467dd86ab72b93e23 (diff)
feat: Add more tests and Jamfile. Improve allocator_op and basic_hash APIs.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/ocl/allocator_op.hpp1
-rw-r--r--include/ocl/basic_hash.hpp25
2 files changed, 24 insertions, 2 deletions
diff --git a/include/ocl/allocator_op.hpp b/include/ocl/allocator_op.hpp
index dcdbdaa..f515586 100644
--- a/include/ocl/allocator_op.hpp
+++ b/include/ocl/allocator_op.hpp
@@ -48,6 +48,7 @@ namespace ocl
}
};
+ /// \brief Allocator operations structure. Takes care of memory mgmt within a pool.
template <typename ret_type, typename allocator_new, typename allocator_delete>
class allocator_op
{
diff --git a/include/ocl/basic_hash.hpp b/include/ocl/basic_hash.hpp
index 6a39df2..00c3768 100644
--- a/include/ocl/basic_hash.hpp
+++ b/include/ocl/basic_hash.hpp
@@ -1,3 +1,9 @@
+/*
+ * 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
@@ -6,8 +12,9 @@
/// @brief OCL equivalence namespace.
namespace ocl
{
+ /// \brief Hash helper.
template <class T>
- struct basic_hash final
+ struct basic_hash
{
using result_type = typename T::result_type;
using type = T;
@@ -18,6 +25,20 @@ namespace ocl
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 \ No newline at end of file