some changes

This commit is contained in:
Naios 2015-07-01 20:26:59 +02:00
parent 111c76eada
commit bd3c105b98
2 changed files with 51 additions and 13 deletions

View File

@ -303,6 +303,15 @@ namespace detail
typedef fu::identity<Left..., Right...> type; typedef fu::identity<Left..., Right...> type;
}; };
template<typename Left, typename Right>
struct concat_identities_as_pack;
template<typename... Left, typename... Right>
struct concat_identities_as_pack<fu::identity<Left...>, fu::identity<Right...>>
{
typedef fu::identity<Left..., std::tuple<Right...>> type;
};
template<typename... _CTy> template<typename... _CTy>
struct multiple_chainer_test struct multiple_chainer_test
{ {
@ -425,24 +434,49 @@ 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... Rest> template<typename Args, typename Pack, typename... Rest>
struct multiple_result_maker; struct multiple_result_maker;
template<typename Previous, typename Next> template<typename... Args, typename... Pack>
struct multiple_result_maker<Previous, Next> struct multiple_result_maker<fu::identity<Args...>, fu::identity<Pack...>>
{ {
typedef typename concat_identities< typedef fu::identity<Args...> arguments_t;
Previous, typename unary_chainer_t<Next, _ATy...>::callback_arguments_t
>::type arguments_t; typedef fu::identity<Pack...> arguments_storage_t;
}; };
template<typename Previous, typename Next, typename... Rest> template<typename Args, typename Pack, typename Next>
struct multiple_result_maker<Previous, Next, Rest...> struct multiple_result_maker<Args, Pack, Next>
: public multiple_result_maker< : public multiple_result_maker<
typename concat_identities< typename concat_identities<
Previous, typename unary_chainer_t<Next, _ATy...>::callback_arguments_t Args,
typename unary_chainer_t<Next, _ATy...>::callback_arguments_t
>::type, >::type,
Rest...> { }; typename concat_identities_as_pack<
Pack,
// typename wrap_in_tuple<
typename unary_chainer_t<Next, _ATy...>::callback_arguments_t
// >::type
>::type
> { }
template<typename Args, typename Pack, typename Next, typename... Rest>
struct multiple_result_maker<Args, Pack, Next, Rest...>
: public multiple_result_maker<
typename concat_identities<
Args,
typename unary_chainer_t<Next, _ATy...>::callback_arguments_t
>::type,
typename concat_identities_as_pack <
Pack,
typename unary_chainer_t<Next, _ATy...>::callback_arguments_t
>::type,
Rest...
> { };
template<typename... Args>
using result_maker_of_t =
multiple_result_maker<fu::identity<>, fu::identity<>, Args...>;
}; };
} }

View File

@ -232,20 +232,24 @@ int main(int /*argc*/, char** /*argv*/)
detail::unary_chainer_t<std::function<Continuable<bool>()>>::callback_arguments_t args213987; detail::unary_chainer_t<std::function<Continuable<bool>()>>::callback_arguments_t args213987;
detail::functional_traits<>::multiple_result_maker< typedef detail::result_maker_of_t<
fu::identity<>,
std::function<Continuable<bool>()>, std::function<Continuable<bool>()>,
decltype(CastSpellPromise(2)), decltype(CastSpellPromise(2)),
decltype(TrivialPromise()), decltype(TrivialPromise()),
std::function<Continuable<float, double>()> std::function<Continuable<float, double>()>
>::arguments_t test282; > maker;
maker::arguments_t test282_args;
maker::arguments_storage_t test282_pack;
// static_assert(std::is_same<>::value, // static_assert(std::is_same<>::value,
detail::concat_identities<fu::identity<int, bool, char>, fu::identity<float, double>>::type myt; detail::concat_identities<fu::identity<int, bool, char>, fu::identity<float, double>>::type myt;
std::tuple<int, std::vector<int>> tup;
std::cout << "ok" << std::endl; std::cout << "ok" << std::endl;
return 0; return 0;
} }