folly::ReadMostlySharedPtr

Shared reader handle to a read-mostly managed object.

Synopsis

Declared in <folly/concurrency/memory/ReadMostlySharedPtr.h>

template<
    typename U,
    typename RefCount2 = DefaultRefCount>
class ReadMostlySharedPtr;

Description

A cheaply copyable pointer that keeps the object alive while it is held. It is typically obtained from a ReadMostlyMainPtr or ReadMostlyWeakPtr and is meant for the read-mostly access path.

Member Functions

NameDescription
ReadMostlySharedPtr [constructor]Constructors
~ReadMostlySharedPtr [destructor]Destroys the shared pointer and releases its reference.
operator= Assignment operators
get Returns the raw pointer to the referenced object.
getStdShared Returns a standard shared pointer aliasing the referenced object.
operator* Dereferences the referenced object.
operator-> Accesses members of the referenced object.
reset Releases the reference, making this pointer empty.
unique Tests whether this is the only reference to the object.
use_count Returns the current reference count of the object.
operator bool Tests whether the pointer references an object.
operator== Equality operators

Friends

NameDescription
folly::ReadMostlySharedPtrShared reader handle to a read-mostly managed object.
folly::ReadMostlyWeakPtrNon-owning weak reference to a read-mostly managed object.

Non-Member Functions

NameDescription
operator!=Tests whether a shared pointer is non-empty.
operator==Tests whether a shared pointer is empty.
tryGetShutdownSocketSetFastReturns the process-global shutdown socket set using a read-mostly pointer.

Template Parameters

NameDescription
TThe pointed-to object type.
RefCountThe reference-count implementation to use.