Gets the pre‐existing value if already initialized or creates the value returned by the provided factory function. If the value already exists, then the provided function is not called.

Synopsis

Declared in <folly/synchronization/DelayedInit.h>

template<typename Func>
T&
try_emplace_with(Func func);

Return Value

A reference to the stored value.

Parameters

Name

Description

func

The factory invoked to produce the value on first access.

Created with MrDocs