folly::ReadMostlyMainPtr

Owning pointer that gives cheap, lock-free reads to shared objects.

Synopsis

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

template<
    typename T,
    typename RefCount = DefaultRefCount>
class ReadMostlyMainPtr;

Description

Holds the single main reference to an object while allowing many readers to obtain a ReadMostlySharedPtr without contending on a shared atomic counter.

Member Functions

NameDescription
ReadMostlyMainPtr [constructor]Constructors
~ReadMostlyMainPtr [destructor]Destroys the main pointer and releases its object.
operator= Assignment operators
get Returns the raw pointer to the managed object.
getShared Obtains a read-mostly shared pointer to the managed object.
getStdShared Returns a standard shared pointer aliasing the managed object.
operator* Dereferences the managed object.
operator-> Accesses members of the managed object.
reset reset overloads
operator bool Tests whether the pointer manages an object.
operator== Equality operators

Friends

NameDescription
folly::ReadMostlyMainPtrDeleterThis can be used to destroy multiple ReadMostlyMainPtrs at once.
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 main pointer is non-empty.
operator==Tests whether a main pointer is empty.

Template Parameters

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