From a2987feb8cb486c2ff124669190c1abd4e80a8f9 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 7 Dec 2025 15:30:08 -0500 Subject: chore: public API improvements of the core module. new headers in WiP. Signed-off-by: Amlal El Mahrouss --- include/ocl/allocator_op.hpp | 2 +- include/ocl/is_same.hpp | 23 +++++++++++++++++++---- include/ocl/unique_ptr.hpp | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 include/ocl/unique_ptr.hpp (limited to 'include') diff --git a/include/ocl/allocator_op.hpp b/include/ocl/allocator_op.hpp index 9092800..eff3bac 100644 --- a/include/ocl/allocator_op.hpp +++ b/include/ocl/allocator_op.hpp @@ -1,6 +1,6 @@ /* * File: allocator_op.hpp - * Purpose: Allocator Operations container. + * Purpose: Allocate from a pool. * Author: Amlal El Mahrouss (amlal@nekernel.org) * Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License. Licensed under the BSL 1.0 license */ diff --git a/include/ocl/is_same.hpp b/include/ocl/is_same.hpp index de3425e..ec3eb66 100644 --- a/include/ocl/is_same.hpp +++ b/include/ocl/is_same.hpp @@ -68,7 +68,7 @@ namespace ocl T left_ = 127, right_ = 127; public: - using result_type = T; + using result_type = bool; constexpr result_type hash() { @@ -84,7 +84,7 @@ namespace ocl T left_ = 127, right_ = 127; public: - using result_type = T; + using result_type = bool; constexpr result_type hash() { @@ -99,11 +99,26 @@ namespace ocl T left_ = 5, right_ = 3; public: - using result_type = T; + using result_type = bool; constexpr result_type hash() { - return left_ / right_ == 1; + return (left_ / right_) == 1; + } + }; + + template + struct equiv_is + { + private: + T left_{}, right_{}; + + public: + using result_type = bool; + + constexpr result_type hash() + { + return (left_ / right_); } }; } // namespace ocl diff --git a/include/ocl/unique_ptr.hpp b/include/ocl/unique_ptr.hpp new file mode 100644 index 0000000..253fc0a --- /dev/null +++ b/include/ocl/unique_ptr.hpp @@ -0,0 +1,20 @@ +/* + * File: unique_pr.hpp + * Purpose: Unique Pointer helpers. + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License. Licensed under the BSL 1.0 license + */ + +#ifndef __OCL_UNIQUE_PTR +#define __OCL_UNIQUE_PTR + +#include +#include + +namespace ocl +{ + template + using unique_ptr = std::unique_ptr; +} + +#endif // ifndef __OCL_UNIQUE_PTR \ No newline at end of file -- cgit v1.2.3