#include <userver/utils/lazy_shared_ptr.hpp>
A lazy wrapper around utils::SharedReadablePtr that fetches the data on first access.
Provides standard thread-safety guarantee: const methods can be called concurrently. Once fetched, the same data is guaranteed to be returned unless the pointer is assigned to.
Definition at line 29 of file lazy_shared_ptr.hpp.
Public Member Functions | |
| LazySharedPtr () noexcept | |
| The default constructor, initializes with nullptr. | |
| LazySharedPtr (utils::SharedReadablePtr< T > ptr) noexcept | |
| The non-lazy constructor. | |
| LazySharedPtr (std::function< utils::SharedReadablePtr< T >()> function) noexcept | |
| The lazy constructor. | |
| LazySharedPtr (const LazySharedPtr &other) | |
| The copy constructor. | |
| LazySharedPtr (LazySharedPtr &&other) noexcept | |
| The move constructor. | |
| LazySharedPtr & | operator= (const LazySharedPtr &other) |
| The copy assignment operator. | |
| LazySharedPtr & | operator= (LazySharedPtr &&other) noexcept |
| The move assignment operator. | |
| const T * | Get () const & |
| Get a pointer to the data (may be null). Fetches the data on the first access. | |
| const utils::SharedReadablePtr< T > & | GetShared () const & |
| Get a smart pointer to the data (may be null). Fetches the data on the first access. | |
| const T & | operator* () const & |
| const T * | operator-> () const & |
| operator bool () const & | |
| operator const utils::SharedReadablePtr< T > & () const & | |
| operator std::shared_ptr< const T > () const & | |
|
inlinenoexcept |
The default constructor, initializes with nullptr.
Definition at line 32 of file lazy_shared_ptr.hpp.
|
inlinenoexcept |
The non-lazy constructor.
Definition at line 35 of file lazy_shared_ptr.hpp.
|
inlinenoexcept |
The lazy constructor.
Definition at line 39 of file lazy_shared_ptr.hpp.
|
inline |
The copy constructor.
Definition at line 45 of file lazy_shared_ptr.hpp.
|
inlinenoexcept |
The move constructor.
Definition at line 56 of file lazy_shared_ptr.hpp.
|
inline |
Get a pointer to the data (may be null). Fetches the data on the first access.
Definition at line 80 of file lazy_shared_ptr.hpp.
|
inline |
Get a smart pointer to the data (may be null). Fetches the data on the first access.
Definition at line 94 of file lazy_shared_ptr.hpp.
|
inlineexplicit |
Definition at line 124 of file lazy_shared_ptr.hpp.
|
inline |
Definition at line 127 of file lazy_shared_ptr.hpp.
|
inline |
Definition at line 130 of file lazy_shared_ptr.hpp.
|
inline |
|
inline |
|
inline |
The copy assignment operator.
Definition at line 65 of file lazy_shared_ptr.hpp.
|
inlinenoexcept |
The move assignment operator.
Definition at line 71 of file lazy_shared_ptr.hpp.