mirror of
https://github.com/Naios/continuable.git
synced 2026-02-07 10:19:46 +08:00
some work on identity chaining
This commit is contained in:
parent
af8f0cfce3
commit
30f4907e59
@ -277,7 +277,6 @@ inline auto make_continuable()
|
|||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Helper trait for unary chains like `Continuable::then`
|
/// Helper trait for unary chains like `Continuable::then`
|
||||||
template <typename _CTy, typename... _ATy>
|
template <typename _CTy, typename... _ATy>
|
||||||
struct unary_chainer_t
|
struct unary_chainer_t
|
||||||
@ -424,34 +423,26 @@ namespace detail
|
|||||||
return remove_void_trait(box_continuable_trait(std::forward<_CTy>(functional)));
|
return remove_void_trait(box_continuable_trait(std::forward<_CTy>(functional)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Current, typename First, typename... Rest>
|
template<typename Current, typename... Rest>
|
||||||
struct multiple_result_maker;
|
struct multiple_result_maker;
|
||||||
|
|
||||||
template<typename... Previous, typename Last>
|
template<typename Previous, typename Last>
|
||||||
struct multiple_result_maker<fu::identity<Previous...>, Last>
|
struct multiple_result_maker<Previous, Last>
|
||||||
{
|
{
|
||||||
// typedef decltype(correct(std::declval<typename std::decay<Last>::type>())) corrected_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
typedef typename concat_identities<
|
typedef typename concat_identities<
|
||||||
fu::identity<Previous...>,
|
Previous, typename unary_chainer_t<Last, _ATy...>::arguments_t
|
||||||
fu::argument_type_of_t<Last>
|
>::type arguments_t;
|
||||||
> type;
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Previous, typename First, typename... Rest>
|
template<typename Previous, typename Next, typename... Rest>
|
||||||
struct multiple_result_maker<fu::identity<Previous...>, First, Rest...>
|
struct multiple_result_maker<Previous, Next, Rest...>
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
typedef typename multiple_result_maker<
|
typedef typename multiple_result_maker<
|
||||||
typename concat_identities<
|
typename concat_identities<
|
||||||
fu::identity<Previous...>,
|
Previous, typename unary_chainer_t<Next, _ATy...>::arguments_t
|
||||||
fu::argument_type_of_t<First>
|
>::type,
|
||||||
>,
|
|
||||||
Rest...
|
Rest...
|
||||||
> type;
|
>::arguments_t arguments_t;
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
7
test.cpp
7
test.cpp
@ -233,9 +233,12 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
detail::functional_traits<>::multiple_result_maker<
|
detail::functional_traits<>::multiple_result_maker<
|
||||||
fu::identity<>,
|
fu::identity<>,
|
||||||
|
|
||||||
std::function<Continuable<int>>
|
std::function<Continuable<int>()>,
|
||||||
|
std::function<Continuable<float>()>
|
||||||
|
|
||||||
> test282;
|
>::arguments_t test282;
|
||||||
|
|
||||||
|
detail::concat_identities<fu::identity<int, bool, char>, fu::identity<float, double>>::type myt;
|
||||||
|
|
||||||
std::cout << "ok" << std::endl;
|
std::cout << "ok" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user