mrdocs::makeOverload

Factory function that creates an Overload from the given callables.

Synopsis

Declared in <mrdocs/ADT/Overload.hpp>

template<class... Ts>
[[nodiscard]]
constexpr
Overload<std::decay_t<Ts>...>
makeOverload(Ts&&... xs) noexcept(/* see-below */);

Description

Prefer this over constructing Overload directly when you need perfect forwarding and decayed storage.


auto visitor = fn::makeOverload(
     [](int) { return 1; },
     [](double) { return 2; }
);

Exception specification

This function is potentially-throwing unless (std::is_nothrow_constructible_v<std::decay_t<Ts>, Ts &&> && ...).

Return Value

An Overload whose base classes are the decayed types of the provided callables.

NOTE

The return value should not be discarded.

Parameters

NameDescription
xsThe callables to combine.