Skip to content

ui::Callback< R(Args...)>

Header: winui/core/Callback.hpp.

template <typename R, typename... Args> class Callback< R(Args...)>

Derives from std::move_only_function< R(Args...)>.

See the primary template.

Callback

Callback() noexcept = default

Empty.

Callback

template <typename F>
Callback(F&& handler)
    requires detail::is_outcome<R> && std::invocable<std::decay_t<F>&, Args...> && std::is_void_v<std::invoke_result_t<std::decay_t<F>&, Args...>> && std::move_constructible<std::decay_t<F>>

A handler returning an outcome, from a callable that returns nothing: the event's default.

Callback

template <typename F>
Callback(F&& handler)
    requires detail::is_outcome<R> && (sizeof...(Args) > 0) && std::invocable<std::decay_t<F>&> && (!std::invocable<std::decay_t<F>&, Args...>) && std::is_void_v<std::invoke_result_t<std::decay_t<F>&>> && std::move_constructible<std::decay_t<F>>

The same, from a callable that takes nothing and returns nothing.

Callback

template <typename F>
Callback(F&& handler)
    requires (sizeof...(Args) > 0) && std::invocable<std::decay_t<F>&> && (!std::invocable<std::decay_t<F>&, Args...>) && std::move_constructible<std::decay_t<F>> && (std::is_void_v<R> || std::convertible_to<std::invoke_result_t<std::decay_t<F>&>, R>) && (!(detail::is_outcome<R> && std::is_void_v<std::invoke_result_t<std::decay_t<F>&>>))

A handler with a payload, from a callable that takes nothing (and returns what the handler returns, if anything).