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)
This commit is contained in:
parent
7ea7866163
commit
3523b897c2
3 changed files with 19 additions and 11 deletions
|
|
@ -486,6 +486,10 @@ namespace func{
|
|||
typedef typename Splice<ArgsList, ValList>::Back LeftReduced;
|
||||
typedef typename Splice<ArgsList, ValList, ROFFSET>::Front RightReduced;
|
||||
|
||||
typedef typename Types<LeftReduced>::Seq ArgsL;
|
||||
typedef typename Types<RightReduced>::Seq ArgsR;
|
||||
|
||||
|
||||
// build a list, where each of the *remaining* arguments is replaced by a placeholder marker
|
||||
typedef typename func::PlaceholderTuple<LeftReduced>::List LeftPlaceholders;
|
||||
typedef typename func::PlaceholderTuple<RightReduced>::List RightPlaceholders;
|
||||
|
|
@ -495,8 +499,8 @@ namespace func{
|
|||
typedef typename Splice<ArgsList, LeftPlaceholders, VAL_CNT>::List LeftReplaced;
|
||||
typedef typename Splice<ArgsList, RightPlaceholders, 0 >::List RightReplaced;
|
||||
|
||||
typedef typename Tuple<LeftReduced>::Type ArgsL;
|
||||
typedef typename Tuple<RightReduced>::Type ArgsR;
|
||||
typedef typename Types<LeftReplaced>::Seq LeftReplacedTypes;
|
||||
typedef typename Types<RightReplaced>::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<LeftReplaced>::TupleType LeftReplacedArgs;
|
||||
using LeftReplacedArgs = Tuple<LeftReplacedTypes>;
|
||||
|
||||
/** 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<RightReplaced>::TupleType RightReplacedArgs;
|
||||
using RightReplacedArgs = Tuple<RightReplacedTypes>;
|
||||
|
||||
|
||||
public:
|
||||
|
|
@ -692,11 +696,14 @@ namespace func{
|
|||
, PlaceholdersBehind >::List PreparedArgs;
|
||||
typedef typename Append<RemainingFront, RemainingBack>::List ReducedArgs;
|
||||
|
||||
typedef tuple::BuildTuple<PreparedArgs, ValList, n> BuildPreparedArgs;
|
||||
typedef typename Tuple<PreparedArgs>::TupleType PreparedArgTuple;
|
||||
typedef typename Types<ReducedArgs>::Seq RemainingArgs;
|
||||
using PreparedArgTypes = typename Types<PreparedArgs>::Seq;
|
||||
using RemainingArgs = typename Types<ReducedArgs>::Seq;
|
||||
|
||||
using ReducedSig = typename FunctionTypedef<Ret,RemainingArgs>::Sig;
|
||||
|
||||
using BuildPreparedArgs = tuple::BuildTuple<PreparedArgs, ValList, n>;
|
||||
typedef Tuple<PreparedArgTypes> PreparedArgTuple;
|
||||
|
||||
typedef typename FunctionTypedef<Ret,RemainingArgs>::Sig ReducedSig;
|
||||
|
||||
public:
|
||||
typedef function<ReducedSig> ReducedFunc;
|
||||
|
|
|
|||
|
|
@ -336,8 +336,9 @@ namespace test {
|
|||
|
||||
|
||||
// finally combine all techniques....
|
||||
typedef Tuple<List2>::Type NumberzArg;
|
||||
typedef FunctionTypedef<int,NumberzArg>::Sig NumberzSig;
|
||||
using NumberzArg = Types<List2>::Seq;
|
||||
using NumberzSig = FunctionTypedef<int,NumberzArg>::Sig;
|
||||
|
||||
Tuple<NumberzArg> numberzTup (Num<5>(22), Num<6>(33), Num<7>(44));
|
||||
|
||||
FunctionClosure<NumberzSig> numClo (getNumberz<5,6,7>, numberzTup );
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ namespace test {
|
|||
string >
|
||||
showDump (Tuple<TYPES> const& tuple)
|
||||
{
|
||||
typedef typename Tuple<TYPES>::Type TypeSeq;
|
||||
typedef typename Types<TYPES>::Seq TypeSeq;
|
||||
Tuple<TypeSeq> plainTuple (tuple);
|
||||
|
||||
typedef BuildTupleAccessor<TypeSeq, TupleElementDisplayer> BuildAccessor;
|
||||
|
|
|
|||
Loading…
Reference in a new issue