new additions in this area now reasonable covered (closes #142)
This commit is contained in:
parent
f70bb0ad6a
commit
81d0e133c8
4 changed files with 74 additions and 16 deletions
|
|
@ -172,11 +172,11 @@ namespace typelist{
|
|||
template<class B, class BS,
|
||||
class O, class OS >
|
||||
struct Splice<Node<B,BS>,Node<O,OS>,0> { typedef Node<O, typename Splice<BS,OS, 0>::List> List;
|
||||
typedef NullType Front;
|
||||
typedef NullType Front;
|
||||
typedef typename Splice<BS,OS, 0>::Back Back; };
|
||||
|
||||
template<class B, class BS>
|
||||
struct Splice<Node<B,BS>, NullType, 0> { typedef Node<B, BS> List;
|
||||
struct Splice<Node<B,BS>, NullType, 0> { typedef Node<B, BS> List;
|
||||
typedef NullType Front;
|
||||
typedef Node<B, BS> Back; };
|
||||
|
||||
|
|
@ -188,19 +188,23 @@ namespace typelist{
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Allows to access various parts of a given typelist:
|
||||
* Start and End, Prefix and Tail..
|
||||
*/
|
||||
template<class TYPES>
|
||||
struct Dissect;
|
||||
|
||||
template<class T, class TYPES>
|
||||
struct Dissect<Node<T,TYPES> >
|
||||
{
|
||||
typedef Node<T,TYPES> List;
|
||||
typedef T Head;
|
||||
typedef Node<T,NullType> First;
|
||||
typedef TYPES Tail;
|
||||
typedef typename SplitLast<List>::List Prefix;
|
||||
typedef typename SplitLast<List>::Type End;
|
||||
typedef Node<End,NullType> Last;
|
||||
typedef Node<T,TYPES> List; ///< the complete list
|
||||
typedef T Head; ///< first element
|
||||
typedef Node<T,NullType> First; ///< a list containing the first element
|
||||
typedef TYPES Tail; ///< remainder of the list starting with the second elm.
|
||||
typedef typename SplitLast<List>::List Prefix;///< all of the list, up to but extcluding the last element
|
||||
typedef typename SplitLast<List>::Type End; ///< the last element
|
||||
typedef Node<End,NullType> Last; ///< a list containing the last element
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
|||
|
|
@ -488,10 +488,11 @@ return: 0
|
|||
END
|
||||
|
||||
|
||||
TEST "TypeListManipl_test" TypeListManipl_test <<END
|
||||
TEST "typelist manipulation" TypeListManipl_test <<END
|
||||
out: List1 :-<1>-<2>-<3>-
|
||||
out: List2 :-<5>-<6>-<7>-
|
||||
out: Added2 :-<3>-<4>-<5>-
|
||||
out: FilterEven :-<2>-<6>-
|
||||
out: Append1 :-
|
||||
out: Append2 :-<11>-<22>-
|
||||
out: Append3 :-<111>-
|
||||
|
|
@ -522,7 +523,19 @@ out: Back2 :-<3>-
|
|||
out: Back3 :-
|
||||
out: Front4 :-<1>-
|
||||
out: Back4 :-<2>-<3>-
|
||||
out: FilterEven :-<2>-<6>-
|
||||
out: Prefix :-<1>-<2>-
|
||||
out: ElmL :-<3>-
|
||||
out: NPrefix :-
|
||||
out: Types<Elm1> :-<3>-
|
||||
out: NList :-
|
||||
out: Types<Nil> :-
|
||||
out: LL :-<1>-<2>-<3>-<5>-<6>-<7>-
|
||||
out: List :-<1>-<2>-<3>-<5>-<6>-<7>-
|
||||
out: First :-<1>-
|
||||
out: Tail :-<2>-<3>-<5>-<6>-<7>-
|
||||
out: Prefix :-<1>-<2>-<3>-<5>-<6>-
|
||||
out: Last :-<7>-
|
||||
out: HeadEnd :-<1>-<7>-
|
||||
out: Prefix1 :
|
||||
out: \+---<11>-<22>-\+-
|
||||
out: Prefix2 :
|
||||
|
|
@ -609,6 +622,40 @@ return: 0
|
|||
END
|
||||
|
||||
|
||||
TEST "type sequence manipulation" TypeSeqManipl_test <<END
|
||||
out: LL :-<1>-<2>-<3>-<7>-<8>-<9>-
|
||||
out: Seq :-<1>-<2>-<3>-<7>-<8>-<9>-
|
||||
out: SeqList :-<1>-<2>-<3>-<7>-<8>-<9>-
|
||||
out: NulS :-
|
||||
out: Prepend1 :-<5>-<1>-<2>-<3>-
|
||||
out: Prepend2 :-<·>-<1>-<2>-<3>-
|
||||
out: Prepend3 :-<5>-
|
||||
out: Prepend4 :-
|
||||
out: Seq_0 :-<7>-<8>-<9>-<1>-<2>-<3>-
|
||||
out: Seq_1 :-<8>-<9>-<1>-<2>-<3>-
|
||||
out: Seq_2 :-<9>-<1>-<2>-<3>-
|
||||
out: Seq_3 :-<1>-<2>-<3>-
|
||||
out: Seq_4 :-<2>-<3>-
|
||||
out: Seq_5 :-<3>-
|
||||
out: Seq_6 :-
|
||||
out: Head_0 :-<7>-
|
||||
out: Head_1 :-<8>-
|
||||
out: Head_2 :-<9>-
|
||||
out: Head_3 :-<1>-
|
||||
out: Head_4 :-<2>-
|
||||
out: Head_5 :-<3>-
|
||||
out: Head_6 :-
|
||||
out: Seq :-<1>-<2>-<3>-<7>-<8>-<9>-
|
||||
out: List :-<1>-<2>-<3>-<7>-<8>-<9>-
|
||||
out: First :-<1>-
|
||||
out: Tail :-<2>-<3>-<7>-<8>-<9>-
|
||||
out: Prefix :-<1>-<2>-<3>-<7>-<8>-
|
||||
out: Last :-<9>-
|
||||
out: HeadEnd :-<1>-<9>-
|
||||
return: 0
|
||||
END
|
||||
|
||||
|
||||
TEST "TypeTuple_test" TypeTuple_test <<END
|
||||
out: L1 :-<1>-<3>-<5>-
|
||||
out: L2 :-<2>-<4>-
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#include "lib/meta/generator.hpp"
|
||||
#include "lib/meta/typelist-util.hpp"
|
||||
#include "meta/typelist-diagnostics.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <iostream>
|
||||
|
|
@ -98,11 +97,11 @@ namespace test {
|
|||
{
|
||||
check_diagnostics ();
|
||||
check_apply ();
|
||||
check_filter ();
|
||||
check_append ();
|
||||
check_splice ();
|
||||
check_s_last ();
|
||||
check_dissect();
|
||||
check_filter ();
|
||||
check_prefix ();
|
||||
check_distribute();
|
||||
check_combine();
|
||||
|
|
@ -244,7 +243,7 @@ namespace test {
|
|||
|
||||
typedef SplitLast<NullType>::Type Nil;
|
||||
typedef SplitLast<NullType>::List NList;
|
||||
|
||||
|
||||
DISPLAY (NList);
|
||||
DISPLAY (Types<Nil>);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
#include "lib/meta/typeseq-util.hpp"
|
||||
#include "lib/meta/typelist-util.hpp"
|
||||
#include "meta/typelist-diagnostics.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <iostream>
|
||||
|
|
@ -105,8 +104,9 @@ namespace test {
|
|||
DISPLAY (LL);
|
||||
|
||||
typedef Types<LL>::Seq Seq;
|
||||
typedef Seq::List SeqList;
|
||||
DISPLAY (Seq);
|
||||
DISPLAY (Seq::List);
|
||||
DISPLAY (SeqList);
|
||||
|
||||
typedef Types<NodeNull>::Seq NulS;
|
||||
DISPLAY (NulS);
|
||||
|
|
@ -141,8 +141,16 @@ namespace test {
|
|||
typedef Shifted<Seq,2>::Type Seq_2; DISPLAY (Seq_2);
|
||||
typedef Shifted<Seq,3>::Type Seq_3; DISPLAY (Seq_3);
|
||||
typedef Shifted<Seq,4>::Type Seq_4; DISPLAY (Seq_4);
|
||||
typedef Shifted<Seq,5>::Type Seq_5; DISPLAY (Seq_5);
|
||||
typedef Shifted<Seq,6>::Type Seq_6; DISPLAY (Seq_6);
|
||||
|
||||
typedef Types<Shifted<Seq,0>::Head> Head_0; DISPLAY (Head_0);
|
||||
typedef Types<Shifted<Seq,1>::Head> Head_1; DISPLAY (Head_1);
|
||||
typedef Types<Shifted<Seq,2>::Head> Head_2; DISPLAY (Head_2);
|
||||
typedef Types<Shifted<Seq,3>::Head> Head_3; DISPLAY (Head_3);
|
||||
typedef Types<Shifted<Seq,4>::Head> Head_4; DISPLAY (Head_4);
|
||||
typedef Types<Shifted<Seq,5>::Head> Head_5; DISPLAY (Head_5);
|
||||
typedef Types<Shifted<Seq,6>::Head> Head_6; DISPLAY (Head_6);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue