qxLib
Classes | Typedefs | Functions
shared_ref.h File Reference
#include <qx/smart_ptr/smart_ptr_ref_adapter.h>
#include <qx/smart_ptr/shared_ref.inl>

Go to the source code of this file.

Classes

class  qx::details::smart_ptr_ref_adapter< std::shared_ptr, T, args_t... >
 

Typedefs

template<class T >
using qx::shared_ref = details::smart_ptr_ref_adapter< std::shared_ptr, T >
 A version of std::shared_ptr that cannot have an invalid value (nullptr) (compile time guaranteed). More...
 

Functions

template<class T , class... constructor_args_t>
shared_ref< T > qx::make_shared_ref (constructor_args_t &&... args)
 Make a unique ref (same as std::make_shared but for qx::shared_ref) More...
 

Detailed Description

Author
Khrapov
Date
25.05.2025

Definition in file shared_ref.h.

Typedef Documentation

◆ shared_ref

template<class T >
using qx::shared_ref = typedef details::smart_ptr_ref_adapter<std::shared_ptr, T>

A version of std::shared_ptr that cannot have an invalid value (nullptr) (compile time guaranteed).

Can only be constructed with make_shared_ref. Cannot be constructed from / assigned from / reset from a shared_ptr. shared_ptr can be extracted via to_shared_ptr().

Template Parameters
T- type to store

Definition at line 24 of file shared_ref.h.

Function Documentation

◆ make_shared_ref()

template<class T , class... constructor_args_t>
shared_ref< T > qx::make_shared_ref ( constructor_args_t &&...  args)

Make a unique ref (same as std::make_shared but for qx::shared_ref)

Template Parameters
T- type to store
constructor_args_t- T constructor types
Parameters
args- T constructor values
Return values
-made shared_ref

Definition at line 14 of file shared_ref.inl.