1#ifndef MSTL_CORE_FUNCTIONAL_APPLY_HPP__
2#define MSTL_CORE_FUNCTIONAL_APPLY_HPP__
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>
62template <
typename Func,
typename Tuple>
63constexpr auto apply(Func&& f, Tuple&& t)
64noexcept(
_INNER __apply_unpack_tuple<_MSTL is_nothrow_invocable, Func, Tuple>::value) ->
decltype(
auto) {
MSTL_NODISCARD constexpr T && forward(remove_reference_t< T > &x) noexcept
完美转发左值
MSTL_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
生成指定长度的索引序列
MSTL_CONSTEXPR14 _INNER __invoke_result_aux< Callable, Args... >::type invoke(Callable &&f, Args &&... args) noexcept(is_nothrow_invocable< Callable, Args... >::value)
统一调用接口
#define _MSTL
全局命名空间MSTL前缀
#define MSTL_END_INNER__
结束inner命名空间
#define _INNER
inner命名空间前缀
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
#define MSTL_BEGIN_INNER__
开始inner命名空间
constexpr auto apply(Func &&f, Tuple &&t) noexcept(_INNER __apply_unpack_tuple< _MSTL is_nothrow_invocable, Func, Tuple >::value) -> decltype(auto)
将元组元素解包作为参数调用函数
bool_constant< false > false_type
表示false的类型
integral_constant< bool, Value > bool_constant
布尔常量包装器