From 860ae778bc9dea21a56424faf443b625d588b380 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Tue, 27 Feb 2018 17:18:52 +0100 Subject: [PATCH] Fix some remaining issues with calculating the signature hint from all or seq compositions --- .../continuable/detail/composition_all.hpp | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/include/continuable/detail/composition_all.hpp b/include/continuable/detail/composition_all.hpp index cc63beb..c8e2e39 100644 --- a/include/continuable/detail/composition_all.hpp +++ b/include/continuable/detail/composition_all.hpp @@ -209,14 +209,26 @@ constexpr auto flatten(T&& tuple) { }); } +struct convert_to_hint { + template + constexpr auto operator()(T...) -> hints::signature_hint_tag; +}; +constexpr auto deduce_from_pack(traits::identity) { + return hints::signature_hint_tag<>{}; +} +template +constexpr auto deduce_from_pack(traits::identity) { + return decltype( + traits::unpack(flatten(std::declval()), convert_to_hint{})){}; +} + template constexpr auto deduce_hint(Composition&& composition) { - auto deduced = flatten( + using deduced_t = decltype( map_pack(all_hint_deducer{}, std::forward(composition))); - - return traits::unpack(std::move(deduced), [](auto... args) { - return hints::signature_hint_tag{}; - }); + // We must guard deduced_t against to be void since this represents an + // empty signature hint. + return deduce_from_pack(traits::identity{}); } } // namespace all