Reads a slot optimistically, then validates the read.

Synopsis

Declared in <folly/ConcurrentBSkipList‐detail.h>

template<
    typename Value,
    typename Storage,
    typename Validator>
std::optional<Value>
loadValidated(
    Storage const& storage,
    Validator&& validate);

Description

Returns nullopt if a writer epoch crossed the read (torn copy is discarded).

Return Value

The value if the read validated, otherwise std::nullopt.

Template Parameters

Name

Description

Value

The value type to extract.

Storage

The slot storage type.

Validator

The seqlock validation callable type.

Parameters

Name

Description

storage

The slot to read.

validate

The callable that confirms the read was consistent.

Created with MrDocs