1#ifndef ENTT_CORE_TUPLE_HPP
2#define ENTT_CORE_TUPLE_HPP
4#include "../stl/tuple.hpp"
5#include "../stl/type_traits.hpp"
6#include "../stl/utility.hpp"
15template<
typename Type>
22template<
typename... Args>
29template<
typename Type>
39template<
typename Type>
41 if constexpr(stl::tuple_size_v<stl::remove_reference_t<Type>> == 1u) {
42 return stl::get<0>(stl::forward<Type>(value));
44 return stl::forward<Type>(value);
52template<
typename Func>
59 template<
typename... Args>
60 constexpr forward_apply(Args &&...args)
noexcept(stl::is_nothrow_constructible_v<Func, Args...>)
61 : Func{
stl::forward<Args>(args)...} {}
69 template<
typename Type>
70 constexpr decltype(
auto)
operator()(Type &&args)
noexcept(
noexcept(stl::apply(stl::declval<Func &>(), args))) {
71 return stl::apply(
static_cast<Func &
>(*
this), stl::forward<Type>(args));
75 template<
typename Type>
76 constexpr decltype(
auto)
operator()(Type &&args)
const noexcept(
noexcept(stl::apply(stl::declval<const Func &>(), args))) {
77 return stl::apply(
static_cast<const Func &
>(*
this), stl::forward<Type>(args));
85template<
typename Func>
Custom EnTT namespace for the standard template library.
constexpr bool is_tuple_v
Helper variable template.
forward_apply(Func) -> forward_apply< stl::remove_cvref_t< Func > >
Deduction guide.
constexpr decltype(auto) unwrap_tuple(Type &&value) noexcept
Utility function to unwrap tuples of a single element.
Utility class to forward-and-apply tuple objects.
constexpr decltype(auto) operator()(Type &&args) noexcept(noexcept(stl::apply(stl::declval< Func & >(), args)))
Forwards and applies the arguments with the underlying function.
constexpr forward_apply(Args &&...args) noexcept(stl::is_nothrow_constructible_v< Func, Args... >)
Constructs a forward-and-apply object.
Provides the member constant value equal to true if a given type is a tuple, false otherwise.