1#ifndef NEFORCE_CORE_FUNCTIONAL_APPLY_HPP__
2#define NEFORCE_CORE_FUNCTIONAL_APPLY_HPP__
13NEFORCE_BEGIN_NAMESPACE__
18template <
template <
typename...>
class,
typename,
typename>
21template <
template <
typename...>
class Trait,
typename T,
typename... U>
22struct __apply_unpack_tuple<Trait, T, tuple<U...>> :
bool_constant<Trait<T, U...>::value> {};
24template <
template <
typename...>
class Trait,
typename T,
typename... U>
25struct __apply_unpack_tuple<Trait, T, tuple<U...>&> :
bool_constant<Trait<T, U&...>::value> {};
27template <
template <
typename...>
class Trait,
typename T,
typename... U>
28struct __apply_unpack_tuple<Trait, T, const tuple<U...>> :
bool_constant<Trait<T, const U...>::value> {};
30template <
template <
typename...>
class Trait,
typename T,
typename... U>
31struct __apply_unpack_tuple<Trait, T, const tuple<U...>&> :
bool_constant<Trait<T,
const U&...>::value> {};
34template <
typename F,
typename Tuple,
size_t... Idx>
61template <
typename Func,
typename Tuple>
62constexpr decltype(
auto)
63apply(Func&& f, Tuple&& t)
noexcept(inner::__apply_unpack_tuple<_NEFORCE is_nothrow_invocable, Func, Tuple>::value) {
70NEFORCE_END_NAMESPACE__
NEFORCE_NODISCARD constexpr T && forward(remove_reference_t< T > &x) noexcept
完美转发左值
NEFORCE_ALWAYS_INLINE enable_if_t< is_void_v< T >, future_result_t< T > > get(future< T > &f)
通用future结果获取函数
integer_sequence< size_t, Values... > index_sequence
索引序列
make_integer_sequence< size_t, Size > make_index_sequence
生成指定长度的索引序列
NEFORCE_CONSTEXPR14 inner::__invoke_result_aux< Callable, Args... >::type invoke(Callable &&f, Args &&... args) noexcept(is_nothrow_invocable< Callable, Args... >::value)
统一调用接口
constexpr decltype(auto) apply(Func &&f, Tuple &&t) noexcept(inner::__apply_unpack_tuple< _NEFORCE is_nothrow_invocable, Func, Tuple >::value)
将元组元素解包作为参数调用函数
bool_constant< false > false_type
表示false的类型
integral_constant< bool, Value > bool_constant
布尔常量包装器