![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <ref.hh>
Public Types | |
| using | element_type = T |
Public Member Functions | |
| ref (const std::shared_ptr< T > &p) | |
| ref (std::shared_ptr< T > &&p) | |
| ref (T *p) | |
| T * | get () const |
| T * | operator-> () const |
| T & | operator* () const |
| std::shared_ptr< T > | get_ptr () const & |
| std::shared_ptr< T > | get_ptr () && |
| operator std::shared_ptr< T > (this auto &&self) | |
| template<typename T2> | |
| ref< T2 > | cast () const |
| template<typename T2> | |
| std::shared_ptr< T2 > | dynamic_pointer_cast () const |
| template<typename T2> requires RefImplicitlyUpcastableTo<T, T2> | |
| operator ref< T2 > () const | |
| auto | operator<=> (const ref< T > &other) const =default |
Friends | |
| template<typename T2, typename... Args> | |
| ref< T2 > | make_ref (Args &&... args) |
A simple non-nullable reference-counted pointer. Actually a wrapper around std::shared_ptr that prevents null constructions.
|
inline |
Implicit conversion to ref of base type (covariance). Downcasts are rejected; use .cast() (throws bad_ref_cast) or .dynamic_pointer_cast() (returns nullptr) instead.
|
inline |
Convenience to avoid explicit get_ptr() call in some cases.