qxLib
shared_ref.inl
Go to the documentation of this file.
1 /**
2 
3  @file shared_ref.inl
4  @author Khrapov
5  @date 25.05.2025
6  @copyright © Nick Khrapov, 2025. All right reserved.
7 
8 **/
9 
10 namespace qx
11 {
12 
13 template<class T, class... constructor_args_t>
14 shared_ref<T> make_shared_ref(constructor_args_t&&... args)
15 {
16  return shared_ref<T>(
18  std::make_shared<T>(std::forward<constructor_args_t>(args)...));
19 }
20 
21 namespace details
22 {
23 
24 template<class T, class... args_t>
25 void smart_ptr_ref_adapter<std::shared_ptr, T, args_t...>::reset(smart_ptr_ref_adapter other) noexcept
26 {
27  *this = std::move(other);
28 }
29 
30 template<class T, class... args_t>
31 typename smart_ptr_ref_adapter<std::shared_ptr, T, args_t...>::original_pointer_type smart_ptr_ref_adapter<
32  std::shared_ptr,
33  T,
34  args_t...>::to_shared_ptr()
35 {
36  return *this;
37 }
38 
39 template<class T, class... args_t>
40 template<class... constructor_args_t>
41 smart_ptr_ref_adapter<std::shared_ptr, T, args_t...>::smart_ptr_ref_adapter(private_token, constructor_args_t&&... args)
42  : super(std::forward<constructor_args_t>(args)...)
43 {
44 }
45 
46 } // namespace details
47 
48 } // namespace qx
shared_ref< T > make_shared_ref(constructor_args_t &&... args)
Make a unique ref (same as std::make_shared but for qx::shared_ref)
Definition: shared_ref.inl:14