MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
call_wrapper.hpp
浏览该文件的文档.
1#ifndef MSTL_CORE_FUNCTIONAL_CALL_WRAPPER_HPP__
2#define MSTL_CORE_FUNCTIONAL_CALL_WRAPPER_HPP__
3
10
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<_MSTL tuple<Func, Args...>>
36 : _INNER __invoke_result_aux<Func, Args...> {};
37
38 using Tuple = _MSTL tuple<decay_t<Types>...>;
39
40 Tuple tup_;
41
50 template <size_t... Index>
51 typename result_t<Tuple>::type __invoke(index_tuple<Index...> idx) {
52 return _MSTL invoke(_MSTL get<Index>(_MSTL move(tup_))...);
53 }
54
55public:
63 template <typename... Args>
64 explicit call_wrapper(Args&&... args)
65 : tup_(_MSTL forward<Args>(args)...) {}
66
73 typename result_t<Tuple>::type operator ()() {
75 return this->__invoke(Indices());
76 }
77};
78
79#ifdef MSTL_SUPPORT_DEDUCTION_GUIDES__
80template <typename... Types>
81call_wrapper(Types...) -> call_wrapper<Types...>;
82#endif
83 // CallWrapper
85
87#endif // MSTL_CORE_FUNCTIONAL_CALL_WRAPPER_HPP__
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结果获取函数
typename build_index_tuple< Num >::type build_index_tuple_t
build_index_tuple的便捷别名
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 _INNER
inner命名空间前缀
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result)
移动范围元素
延迟调用包装器
result_t< Tuple >::type operator()()
函数调用运算符
call_wrapper(Args &&... args)
构造函数
索引元组容器
MSTL元组实现