From 3523b897c2abacf2b1b0e3dbea474141b95b5a2f Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 16 Jan 2016 23:46:47 +0100 Subject: [PATCH] refactoring(#988): disentangle Tuple metafunctions we made double use of our Tuple type, not only as a generic record, but also as a metaprogramming helper. This changeset replaces these helpers with other metafunctions available for our typelists or type sequences (with the exception of code directly related to Tuple itself, since the intention is to delete this code alltogether shortly) --- src/lib/meta/function-closure.hpp | 23 +++++++++++++------- tests/library/meta/function-closure-test.cpp | 5 +++-- tests/library/meta/tuple-diagnostics.hpp | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/lib/meta/function-closure.hpp b/src/lib/meta/function-closure.hpp index fd5ca3926..cd12f1dbc 100644 --- a/src/lib/meta/function-closure.hpp +++ b/src/lib/meta/function-closure.hpp @@ -486,6 +486,10 @@ namespace func{ typedef typename Splice::Back LeftReduced; typedef typename Splice::Front RightReduced; + typedef typename Types::Seq ArgsL; + typedef typename Types::Seq ArgsR; + + // build a list, where each of the *remaining* arguments is replaced by a placeholder marker typedef typename func::PlaceholderTuple::List LeftPlaceholders; typedef typename func::PlaceholderTuple::List RightPlaceholders; @@ -495,8 +499,8 @@ namespace func{ typedef typename Splice::List LeftReplaced; typedef typename Splice::List RightReplaced; - typedef typename Tuple::Type ArgsL; - typedef typename Tuple::Type ArgsR; + typedef typename Types::Seq LeftReplacedTypes; + typedef typename Types::Seq RightReplacedTypes; // create a "builder" helper, which accepts exactly the value tuple elements // and puts them at the right location, while default-constructing the remaining @@ -507,11 +511,11 @@ namespace func{ /** Contains the argument values, starting from left. * Any remaining positions are occupied by binding placeholders */ - typedef typename Tuple::TupleType LeftReplacedArgs; + using LeftReplacedArgs = Tuple; /** Contains the argument values, aligned to the end of the function argument list. * Any remaining positions before are occupied by binding placeholders */ - typedef typename Tuple::TupleType RightReplacedArgs; + using RightReplacedArgs = Tuple; public: @@ -692,11 +696,14 @@ namespace func{ , PlaceholdersBehind >::List PreparedArgs; typedef typename Append::List ReducedArgs; - typedef tuple::BuildTuple BuildPreparedArgs; - typedef typename Tuple::TupleType PreparedArgTuple; - typedef typename Types::Seq RemainingArgs; + using PreparedArgTypes = typename Types::Seq; + using RemainingArgs = typename Types::Seq; + + using ReducedSig = typename FunctionTypedef::Sig; + + using BuildPreparedArgs = tuple::BuildTuple; + typedef Tuple PreparedArgTuple; - typedef typename FunctionTypedef::Sig ReducedSig; public: typedef function ReducedFunc; diff --git a/tests/library/meta/function-closure-test.cpp b/tests/library/meta/function-closure-test.cpp index 9c27b8e8f..7ed7c05fd 100644 --- a/tests/library/meta/function-closure-test.cpp +++ b/tests/library/meta/function-closure-test.cpp @@ -336,8 +336,9 @@ namespace test { // finally combine all techniques.... - typedef Tuple::Type NumberzArg; - typedef FunctionTypedef::Sig NumberzSig; + using NumberzArg = Types::Seq; + using NumberzSig = FunctionTypedef::Sig; + Tuple numberzTup (Num<5>(22), Num<6>(33), Num<7>(44)); FunctionClosure numClo (getNumberz<5,6,7>, numberzTup ); diff --git a/tests/library/meta/tuple-diagnostics.hpp b/tests/library/meta/tuple-diagnostics.hpp index 16a3217d8..6e7c21943 100644 --- a/tests/library/meta/tuple-diagnostics.hpp +++ b/tests/library/meta/tuple-diagnostics.hpp @@ -154,7 +154,7 @@ namespace test { string > showDump (Tuple const& tuple) { - typedef typename Tuple::Type TypeSeq; + typedef typename Types::Seq TypeSeq; Tuple plainTuple (tuple); typedef BuildTupleAccessor BuildAccessor;