blob: 5ab6dba4d6ad9ccc3b988f9aee9f208e10264755 (
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
|
// Copyright 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_SMART_PTR
#define OCL_SMART_PTR
#include <boost/core/null_deleter.hpp>
#include <ocl/detail/config.hpp>
#include <ocl/tracked_ptr.hpp>
#include <memory>
namespace ocl
{
template <class Type, class Del = std::default_delete<Type>>
using unique_ptr = std::unique_ptr<Type, Del>;
template <class Type>
using shared_ptr = std::shared_ptr<Type>;
template <class Type>
using weak_ptr = std::weak_ptr<Type>;
/// @brief Constructs a `delete_ptr`, that is, a pointer that isn't deleted from the heap.
template <class Type>
inline auto delete_ptr(Type* object) -> shared_ptr<Type>
{
return shared_ptr<Type>{object, boost::null_deleter{}};
}
} // namespace ocl
#endif // ifndef OCL_SMART_PTR
|