Constructors

Synopses

Declared in <absl/functional/any_invocable.h>

Constructs the AnyInvocable in an empty state. Invoking it results in undefined behavior.

AnyInvocable() noexcept = default;

Constructs the AnyInvocable from an existing AnyInvocable by a move. Note that f is not guaranteed to be empty after move‐construction, although it may be.

AnyInvocable(AnyInvocable&& f) noexcept = default;

Constructs the AnyInvocable in an empty state from a null pointer.

AnyInvocable(std::nullptr_t unused) noexcept;

Constructs an AnyInvocable from an invocable object.

template<class F>
requires internal_any_invocable::CanConvert<Sig, F>::value
AnyInvocable(F&& f);

Constructs an AnyInvocable that holds an invocable object of type T, which is constructed in‐place from the given arguments.

template<
    class T,
    class... Args>
requires internal_any_invocable::CanEmplace<Sig, T, Args...>::value
explicit
AnyInvocable(
    std::in_place_type_t<T> tag,
    Args&&... args);

Overload of the above constructor to support list‐initialization.

template<
    class T,
    class U,
    class... Args>
requires internal_any_invocable::CanEmplace<
                Sig, T, std::initializer_list<U>&, Args...>::value
explicit
AnyInvocable(
    std::in_place_type_t<T> tag,
    std::initializer_list<U> ilist,
    Args&&... args);

Parameters

Name

Description

f

The AnyInvocable to move from.

unused

Unused parameter.

args

Arguments forwarded to the constructor of T.

tag

A tag that selects this overload.

ilist

Initializer list forwarded to the constructor of T.

Created with MrDocs