From c5522b589b8fae4904e2e84d9bd68e2e3e059fca Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 24 Dec 2025 19:26:16 +0100 Subject: feat: library improvements. Signed-off-by: Amlal El Mahrouss --- include/ocl/allocator_op.hpp | 2 +- include/ocl/detail/config.hpp | 2 ++ include/ocl/tracked_ptr.hpp | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/ocl/allocator_op.hpp b/include/ocl/allocator_op.hpp index f40001f..00a1cd2 100644 --- a/include/ocl/allocator_op.hpp +++ b/include/ocl/allocator_op.hpp @@ -41,7 +41,7 @@ namespace ocl template struct global_array_delete_op final { - using pointer_type = type*; + using pointer_type = type*; using const_pointer_type = const type*; auto operator()(pointer_type t) -> void diff --git a/include/ocl/detail/config.hpp b/include/ocl/detail/config.hpp index 16a74ac..9afbc22 100644 --- a/include/ocl/detail/config.hpp +++ b/include/ocl/detail/config.hpp @@ -55,6 +55,7 @@ namespace ocl { + namespace detail { inline void throw_runtime_error(const boost::string_view& loc = BOOST_CURRENT_LOCATION.to_string()) @@ -62,6 +63,7 @@ namespace ocl throw std::runtime_error(loc.to_string()); } } // namespace detail + } // namespace ocl #endif diff --git a/include/ocl/tracked_ptr.hpp b/include/ocl/tracked_ptr.hpp index c43276d..aace5d8 100644 --- a/include/ocl/tracked_ptr.hpp +++ b/include/ocl/tracked_ptr.hpp @@ -134,8 +134,11 @@ namespace ocl tracked_ptr& operator=(const tracked_ptr&) = delete; public: - using pointer_type = Type*; - using type = Type; + using pointer_type = Type*; + using type = Type; + using reference_type = Type&; + using const_reference_type = const Type&; + using manager_type = tracked_mgr; void reset() { @@ -181,7 +184,6 @@ namespace ocl { if (this != &other) { - this->reset(); ptr_ = other.ptr_; other.ptr_ = nullptr; } @@ -199,10 +201,10 @@ namespace ocl return tracked_ptr(); } - template - inline auto make_tracked(Type&&... arg) -> tracked_ptr + template + inline auto make_tracked(Type&&... arg) -> tracked_ptr { - return tracked_ptr(std::forward(arg)...); + return tracked_ptr(std::forward(arg)...); } template @@ -221,9 +223,9 @@ namespace ocl } } // namespace detail - /// @brief a Must Pass function is a standard way to verify a container' validity, inspired from NeKernel/VMKernel. + /// @brief This function is a standard way to verify a container' validity, inspired from NeKernel/VMKernel. template - inline void must_pass(tracked_ptr& ptr) + inline void try_throw(tracked_ptr& ptr) { if (ptr.manager().allocator().allocated_count_ < ptr.manager().allocator().deallocated_count_) { -- cgit v1.2.3