1#ifndef ENTT_CORE_UTILITY_HPP
2#define ENTT_CORE_UTILITY_HPP
4#include "../stl/type_traits.hpp"
5#include "../stl/utility.hpp"
16template<
typename Type,
typename Class>
17[[nodiscard]]
constexpr auto overload(Type Class::*member)
noexcept {
27template<
typename Func>
28[[nodiscard]]
constexpr auto overload(Func *func)
noexcept {
36template<
typename... Func>
38 using Func::operator()...;
45template<
typename... Func>
52template<
typename Func>
58 constexpr y_combinator(Func recursive)
noexcept(stl::is_nothrow_move_constructible_v<Func>)
59 : func{
stl::move(recursive)} {}
67 template<
typename... Args>
68 constexpr decltype(
auto)
operator()(Args &&...args)
const noexcept(stl::is_nothrow_invocable_v<Func,
const y_combinator &, Args...>) {
69 return func(*
this, stl::forward<Args>(args)...);
73 template<
typename... Args>
74 constexpr decltype(
auto)
operator()(Args &&...args)
noexcept(stl::is_nothrow_invocable_v<Func, y_combinator &, Args...>) {
75 return func(*
this, stl::forward<Args>(args)...);
Custom EnTT namespace for the standard template library.
overloaded(Func...) -> overloaded< Func... >
Deduction guide.
constexpr auto overload(Type Class::*member) noexcept
Constant utility to disambiguate overloaded members of a class.
Helper type for visitors.
constexpr y_combinator(Func recursive) noexcept(stl::is_nothrow_move_constructible_v< Func >)
Constructs a y-combinator from a given function.
constexpr decltype(auto) operator()(Args &&...args) const noexcept(stl::is_nothrow_invocable_v< Func, const y_combinator &, Args... >)
Invokes a y-combinator and therefore its underlying function.