NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
call_wrapper.hpp
浏览该文件的文档.
1#ifndef NEFORCE_CORE_FUNCTIONAL_CALL_WRAPPER_HPP__
2#define NEFORCE_CORE_FUNCTIONAL_CALL_WRAPPER_HPP__
3
10
12NEFORCE_BEGIN_NAMESPACE__
13
19
28template <typename... Types>
30private:
31 template <typename Tuple>
32 struct result_t;
33
34 template <typename Func, typename... Args>
35 struct result_t<_NEFORCE tuple<Func, Args...>> : inner::__invoke_result_aux<Func, Args...> {};
36
37 using Tuple = _NEFORCE tuple<decay_t<Types>...>;
38
39 Tuple tup_;
40
49 template <size_t... Index>
50 typename result_t<Tuple>::type __invoke(index_tuple<Index...> idx) {
51 return _NEFORCE invoke(_NEFORCE get<Index>(_NEFORCE move(tup_))...);
52 }
53
54public:
62 template <typename... Args>
63 explicit call_wrapper(Args&&... args) :
64 tup_(_NEFORCE forward<Args>(args)...) {}
65
72 typename result_t<Tuple>::type operator()() {
74 return this->__invoke(Indices());
75 }
76};
77
78#ifdef NEFORCE_STANDARD_17
79template <typename... Types>
80call_wrapper(Types...) -> call_wrapper<Types...>;
81#endif
82 // CallWrapper
84
85NEFORCE_END_NAMESPACE__
86#endif // NEFORCE_CORE_FUNCTIONAL_CALL_WRAPPER_HPP__
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结果获取函数
typename build_index_tuple< Num >::type build_index_tuple_t
build_index_tuple的便捷别名
NEFORCE_CONSTEXPR14 inner::__invoke_result_aux< Callable, Args... >::type invoke(Callable &&f, Args &&... args) noexcept(is_nothrow_invocable< Callable, Args... >::value)
统一调用接口
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result) noexcept(noexcept(inner::__move_aux(first, last, result)))
移动范围元素
延迟调用包装器
result_t< Tuple >::type operator()()
函数调用运算符
call_wrapper(Args &&... args)
构造函数
索引元组容器
元组实现