1#ifndef ENTT_CORE_UTILITY_HPP
2#define ENTT_CORE_UTILITY_HPP
20 template<
typename Type>
21 [[nodiscard]]
constexpr Type &&
operator()(Type &&value)
const noexcept {
22 return std::forward<Type>(value);
33template<
typename Type,
typename Class>
34[[nodiscard]]
constexpr auto overload(Type Class::*member)
noexcept {
44template<
typename Func>
45[[nodiscard]]
constexpr auto overload(Func *func)
noexcept {
53template<
typename... Func>
55 using Func::operator()...;
62template<
typename... Func>
69template<
typename Func>
75 constexpr y_combinator(Func recursive)
noexcept(std::is_nothrow_move_constructible_v<Func>)
76 : func{std::move(recursive)} {}
84 template<
typename... Args>
85 constexpr decltype(
auto)
operator()(Args &&...args)
const noexcept(std::is_nothrow_invocable_v<Func,
const y_combinator &, Args...>) {
86 return func(*
this, std::forward<Args>(args)...);
90 template<
typename... Args>
91 constexpr decltype(
auto)
operator()(Args &&...args)
noexcept(std::is_nothrow_invocable_v<Func, y_combinator &, Args...>) {
92 return func(*
this, std::forward<Args>(args)...);
overloaded(Func...) -> overloaded< Func... >
Deduction guide.
constexpr auto overload(Type Class::*member) noexcept
Constant utility to disambiguate overloaded members of a class.
Identity function object (waiting for C++20).
constexpr Type && operator()(Type &&value) const noexcept
Returns its argument unchanged.
void is_transparent
Indicates that this is a transparent function object.
Helper type for visitors.
constexpr decltype(auto) operator()(Args &&...args) const noexcept(std::is_nothrow_invocable_v< Func, const y_combinator &, Args... >)
Invokes a y-combinator and therefore its underlying function.
constexpr y_combinator(Func recursive) noexcept(std::is_nothrow_move_constructible_v< Func >)
Constructs a y-combinator from a given function.