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;

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;

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

Name

Description

t

The Try<void> to construct the value into.

func

The function to invoke.

Created with MrDocs