From a52a27cd30c0db6194d9da0a35a93e56d780f705 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Thu, 13 Oct 2016 11:01:18 +0200 Subject: [PATCH] Add the concept of signature hints --- include/continuable/continuable.hpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/include/continuable/continuable.hpp b/include/continuable/continuable.hpp index 8dfbf4d..24ac737 100644 --- a/include/continuable/continuable.hpp +++ b/include/continuable/continuable.hpp @@ -204,6 +204,19 @@ private: bool isOwning{ true }; }; +template +struct SignatureHint : std::true_type { + typedef Identity argument_type; +}; + +template<> +struct SignatureHint : std::false_type { }; + +using AbsentSignatureHint = SignatureHint; + +template +using InferSignatureFrom = AbsentSignatureHint; + template struct undecorate_function; @@ -355,7 +368,8 @@ void invokeContinuation(Data data) { /// Holds the effective data for the continuable, like the current owner status, /// the continuation object and the dispatcher. template + typename DispatcherType, + typename SignatureHintType = InferSignatureFrom> struct ContinuableData { /// The plain continuation type that is stored within the data. /// Continuation types have a templated or a fixed signature @@ -369,6 +383,8 @@ struct ContinuableData { using Continuation = ContinuationType; /// TODO using Dispatcher = DispatcherType; + /// The possible signature hint of the continuation + using SignatureHint = SignatureHintType; ContinuableData(Continuation continuation_, Dispatcher dispatcher_) noexcept @@ -389,7 +405,7 @@ struct ContinuableData { template using ChangeDispatcherTo = ContinuableData< - Continuation, NewType + Continuation, NewType, SignatureHint >; Ownership ownership; @@ -430,7 +446,6 @@ private: Data data; }; - template auto undecorateCombined(Identity, std::tuple combined) {