20#ifndef RIPPLE_BASICS_SHAREDWEAKCACHEPOINTER_H_INCLUDED
21#define RIPPLE_BASICS_SHAREDWEAKCACHEPOINTER_H_INCLUDED
79 operator bool() const noexcept;
A combination of a std::shared_ptr and a std::weak_pointer.
std::shared_ptr< T > const & getStrong() const
Return a strong pointer if this is already a strong pointer (i.e.
bool expired() const
Return true if there is a non-zero strong count.
std::shared_ptr< T > lock() const
If this is a strong pointer, return the strong pointer.
SharedWeakCachePointer()=default
bool convertToWeak()
If this is a strong pointer, attempt to convert it to a weak pointer.
void reset()
Set the pointer to null, decrement the appropriate ref count, and run the appropriate release action.
bool convertToStrong()
If this is a weak pointer, attempt to convert it to a strong pointer.
SharedWeakCachePointer & operator=(SharedWeakCachePointer const &rhs)
std::size_t use_count() const
If this is a strong pointer, return the strong count.
std::variant< std::shared_ptr< T >, std::weak_ptr< T > > combo_
SharedWeakCachePointer(SharedWeakCachePointer const &rhs)
SharedWeakCachePointer(std::shared_ptr< TT > &&rhs)
bool isStrong() const
Return true is this represents a strong pointer.
SharedWeakCachePointer & operator=(std::shared_ptr< TT > const &rhs)
T * get() const
If this is a strong pointer, return the raw pointer.
SharedWeakCachePointer & operator=(std::shared_ptr< TT > &&rhs)
SharedWeakCachePointer(std::shared_ptr< TT > const &rhs)
bool isWeak() const
Return true is this represents a weak pointer.
~SharedWeakCachePointer()
SharedWeakCachePointer(SharedWeakCachePointer &&rhs)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.