folly::tryEmplaceWith

tryEmplaceWith overloads

Synopses

Declared in <folly/Try.h>

Specialization of tryEmplaceWith() for Try<void>.

template<typename Func>
bool
tryEmplaceWith(
    Try<void>& t,
    Func&& func) noexcept;
» more...

Try to in-place construct a new value from the result of a function.

template<
    typename T,
    typename Func>
T*
tryEmplaceWith(
    Try<T>& t,
    Func&& func) noexcept;
» more...

Return Value

  • true if func() completed without an exception, false if func() threw an exception.
  • A pointer to the newly constructed object if it completed successfully, otherwise nullptr if the operation completed with an exception.

Parameters

NameDescription
tThe Try<void> to construct the value into.
funcThe function to invoke.