clean-up: the big anti-bang -- NullType becomes Nil
Since I've convinced myself during the last years that this kind of typelist programming is ''not a workaround'' — it is even superior to pattern matching on variadics for certain kinds of tasks — the empty struct defined as `NullType` got into more widespread use as a marker type in the Lumiera code base. It seems adequate though to give it a much more evocative name
This commit is contained in:
parent
7aa1698a95
commit
f8517b7011
30 changed files with 282 additions and 281 deletions
|
|
@ -286,7 +286,7 @@ namespace lib {
|
||||||
* @internal implementation specialisation to mark the end of a chain
|
* @internal implementation specialisation to mark the end of a chain
|
||||||
*/
|
*/
|
||||||
template<>
|
template<>
|
||||||
class HeteroData<meta::NullType>
|
class HeteroData<meta::Nil>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static size_t constexpr size() { return 0; }
|
static size_t constexpr size() { return 0; }
|
||||||
|
|
@ -305,9 +305,9 @@ namespace lib {
|
||||||
*/
|
*/
|
||||||
template<typename...DATA>
|
template<typename...DATA>
|
||||||
class HeteroData
|
class HeteroData
|
||||||
: public HeteroData<meta::Node<StorageFrame<0, DATA...>, meta::NullType>>
|
: public HeteroData<meta::Node<StorageFrame<0, DATA...>, meta::Nil>>
|
||||||
{
|
{
|
||||||
using _FrontBlock = HeteroData<meta::Node<StorageFrame<0, DATA...>, meta::NullType>>;
|
using _FrontBlock = HeteroData<meta::Node<StorageFrame<0, DATA...>, meta::Nil>>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using NewFrame = typename _FrontBlock::Frame;
|
using NewFrame = typename _FrontBlock::Frame;
|
||||||
|
|
@ -437,7 +437,7 @@ namespace std { // Specialisation to support C++ »Tuple Protocol« and structur
|
||||||
using type = typename lib::HeteroData<DATA...>::template Elm_t<I>;
|
using type = typename lib::HeteroData<DATA...>::template Elm_t<I>;
|
||||||
};
|
};
|
||||||
template<size_t I>
|
template<size_t I>
|
||||||
struct tuple_element<I, lib::HeteroData<lib::meta::NullType> >
|
struct tuple_element<I, lib::HeteroData<lib::meta::Nil> >
|
||||||
{
|
{
|
||||||
static_assert ("accessing element-type of an empty HeteroData block");
|
static_assert ("accessing element-type of an empty HeteroData block");
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -400,9 +400,9 @@ namespace func{
|
||||||
};
|
};
|
||||||
|
|
||||||
template<size_t i>
|
template<size_t i>
|
||||||
struct PlaceholderTuple<NullType, i>
|
struct PlaceholderTuple<Nil, i>
|
||||||
{
|
{
|
||||||
using List = NullType;
|
using List = Nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ namespace meta{
|
||||||
template
|
template
|
||||||
< class TYPES_1, class TYPES_2 ///< the two type collections to pick combinations from
|
< class TYPES_1, class TYPES_2 ///< the two type collections to pick combinations from
|
||||||
, template<class,class,class> class _X_ ///< template with two arg types and a base type
|
, template<class,class,class> class _X_ ///< template with two arg types and a base type
|
||||||
, class BASE = NullType
|
, class BASE = Nil
|
||||||
>
|
>
|
||||||
struct InstantiateChainedCombinations
|
struct InstantiateChainedCombinations
|
||||||
: InstantiateChained< typename CartesianProduct<TYPES_1,TYPES_2>::List
|
: InstantiateChained< typename CartesianProduct<TYPES_1,TYPES_2>::List
|
||||||
|
|
|
||||||
|
|
@ -66,18 +66,18 @@ namespace meta{
|
||||||
template
|
template
|
||||||
< class TYPES // List of Types
|
< class TYPES // List of Types
|
||||||
, template<class> class _X_ // your-template-goes-here
|
, template<class> class _X_ // your-template-goes-here
|
||||||
, class BASE = NullType // Base class at end of chain
|
, class BASE = Nil // Base class at end of chain
|
||||||
>
|
>
|
||||||
class InstantiateForEach;
|
class InstantiateForEach;
|
||||||
|
|
||||||
|
|
||||||
template<template<class> class _X_, class BASE>
|
template<template<class> class _X_, class BASE>
|
||||||
class InstantiateForEach<NullType, _X_, BASE>
|
class InstantiateForEach<Nil, _X_, BASE>
|
||||||
: public BASE
|
: public BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef BASE Unit;
|
using Unit = BASE;
|
||||||
typedef NullType Next;
|
using Next = Nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -91,8 +91,8 @@ namespace meta{
|
||||||
public InstantiateForEach<TYPES, _X_, BASE>
|
public InstantiateForEach<TYPES, _X_, BASE>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _X_<TY> Unit;
|
using Unit = _X_<TY>;
|
||||||
typedef InstantiateForEach<TYPES,_X_> Next;
|
using Next = InstantiateForEach<TYPES,_X_>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -115,18 +115,18 @@ namespace meta{
|
||||||
template
|
template
|
||||||
< class TYPES // List of Types
|
< class TYPES // List of Types
|
||||||
, template<class,class> class _X_ // your-template-goes-here
|
, template<class,class> class _X_ // your-template-goes-here
|
||||||
, class BASE = NullType // Base class at end of chain
|
, class BASE = Nil // Base class at end of chain
|
||||||
>
|
>
|
||||||
class InstantiateChained;
|
class InstantiateChained;
|
||||||
|
|
||||||
|
|
||||||
template<template<class,class> class _X_, class BASE>
|
template<template<class,class> class _X_, class BASE>
|
||||||
class InstantiateChained<NullType, _X_, BASE>
|
class InstantiateChained<Nil, _X_, BASE>
|
||||||
: public BASE
|
: public BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef BASE Unit;
|
using Unit = BASE;
|
||||||
typedef NullType Next;
|
using Next = Nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -141,8 +141,8 @@ namespace meta{
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef InstantiateChained<TYPES,_X_,BASE> Next;
|
using Next = InstantiateChained<TYPES,_X_,BASE>;
|
||||||
typedef _X_<TY,Next> Unit;
|
using Unit = _X_<TY,Next>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -159,7 +159,7 @@ namespace meta{
|
||||||
template
|
template
|
||||||
< class TYPES // List of Types
|
< class TYPES // List of Types
|
||||||
, template<class,class,uint> class _X_ // your-template-goes-here
|
, template<class,class,uint> class _X_ // your-template-goes-here
|
||||||
, class BASE = NullType // Base class at end of chain
|
, class BASE = Nil // Base class at end of chain
|
||||||
, uint i = 0 // incremented on each instantiation
|
, uint i = 0 // incremented on each instantiation
|
||||||
>
|
>
|
||||||
class InstantiateWithIndex;
|
class InstantiateWithIndex;
|
||||||
|
|
@ -169,12 +169,12 @@ namespace meta{
|
||||||
, class BASE
|
, class BASE
|
||||||
, uint i
|
, uint i
|
||||||
>
|
>
|
||||||
class InstantiateWithIndex<NullType, _X_, BASE, i>
|
class InstantiateWithIndex<Nil, _X_, BASE, i>
|
||||||
: public BASE
|
: public BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef BASE Unit;
|
using Unit = BASE;
|
||||||
typedef NullType Next;
|
using Next = Nil;
|
||||||
enum{ COUNT = i };
|
enum{ COUNT = i };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -192,8 +192,8 @@ namespace meta{
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef InstantiateWithIndex<TYPES,_X_,BASE,i+1> Next;
|
using Next = InstantiateWithIndex<TYPES,_X_,BASE,i+1>;
|
||||||
typedef _X_<TY,Next,i> Unit;
|
using Unit = _X_<TY,Next,i>;
|
||||||
enum{ COUNT = Next::COUNT };
|
enum{ COUNT = Next::COUNT };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,13 +148,13 @@ namespace meta {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* temporary workaround: strip trailing NullType entries
|
* temporary workaround: strip trailing Nil-Type entries
|
||||||
* prior to rebinding to the `std::tuple` type.
|
* prior to rebinding to the `std::tuple` type.
|
||||||
*/
|
*/
|
||||||
template<typename...TYPES>
|
template<typename...TYPES>
|
||||||
struct BuildTupleType<TyOLD<TYPES...>>
|
struct BuildTupleType<TyOLD<TYPES...>>
|
||||||
{
|
{
|
||||||
using VariadicSeq = typename StripNullType<TyOLD<TYPES...>>::Seq;
|
using VariadicSeq = typename StripNil<TyOLD<TYPES...>>::Seq;
|
||||||
|
|
||||||
using Type = typename BuildTupleType<VariadicSeq>::Type;
|
using Type = typename BuildTupleType<VariadicSeq>::Type;
|
||||||
};
|
};
|
||||||
|
|
@ -167,7 +167,7 @@ namespace meta {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct BuildTupleType<NullType>
|
struct BuildTupleType<Nil>
|
||||||
{
|
{
|
||||||
using Type = typename BuildTupleType<TyOLD<>>::Type;
|
using Type = typename BuildTupleType<TyOLD<>>::Type;
|
||||||
};
|
};
|
||||||
|
|
@ -348,7 +348,7 @@ namespace meta {
|
||||||
class BuildTupleAccessor< _X_, TySeq<>, TUP, i>
|
class BuildTupleAccessor< _X_, TySeq<>, TUP, i>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Product = _X_<NullType, TUP, TUP, i>; // Note: i == tuple size
|
using Product = _X_<Nil, TUP, TUP, i>; // Note: i == tuple size
|
||||||
};
|
};
|
||||||
///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation will be obsoleted by the removal of old-style type-sequences
|
///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation will be obsoleted by the removal of old-style type-sequences
|
||||||
template
|
template
|
||||||
|
|
@ -359,7 +359,7 @@ namespace meta {
|
||||||
class BuildTupleAccessor< _X_, TyOLD<>, TUP, i>
|
class BuildTupleAccessor< _X_, TyOLD<>, TUP, i>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Product = _X_<NullType, TUP, TUP, i>; // Note: i == tuple size
|
using Product = _X_<Nil, TUP, TUP, i>; // Note: i == tuple size
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -390,7 +390,7 @@ namespace meta {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class TUP, uint n>
|
template<class TUP, uint n>
|
||||||
struct TupleElementDisplayer<NullType, TUP, TUP, n>
|
struct TupleElementDisplayer<Nil, TUP, TUP, n>
|
||||||
: TUP
|
: TUP
|
||||||
{
|
{
|
||||||
TupleElementDisplayer (TUP const& tup)
|
TupleElementDisplayer (TUP const& tup)
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ namespace meta {
|
||||||
template<class TYPES, size_t i>
|
template<class TYPES, size_t i>
|
||||||
struct Pick
|
struct Pick
|
||||||
{
|
{
|
||||||
typedef NullType Type;
|
typedef Nil Type;
|
||||||
};
|
};
|
||||||
template<class TY, class TYPES>
|
template<class TY, class TYPES>
|
||||||
struct Pick<Node<TY,TYPES>, 0>
|
struct Pick<Node<TY,TYPES>, 0>
|
||||||
|
|
@ -99,7 +99,7 @@ namespace meta {
|
||||||
struct Filter;
|
struct Filter;
|
||||||
|
|
||||||
template<template<class> class _P_>
|
template<template<class> class _P_>
|
||||||
struct Filter<NullType,_P_> { typedef NullType List; };
|
struct Filter<Nil,_P_> { typedef Nil List; };
|
||||||
|
|
||||||
template< class TY, class TYPES
|
template< class TY, class TYPES
|
||||||
, template<class> class _P_
|
, template<class> class _P_
|
||||||
|
|
@ -113,7 +113,7 @@ namespace meta {
|
||||||
|
|
||||||
/** append lists-of-types */
|
/** append lists-of-types */
|
||||||
template<class TY1, class TY2>
|
template<class TY1, class TY2>
|
||||||
struct Append { typedef Node<TY1, typename Append<TY2,NullType>::List> List; };
|
struct Append { typedef Node<TY1, typename Append<TY2,Nil>::List> List; };
|
||||||
|
|
||||||
template< class TY, class TYPES
|
template< class TY, class TYPES
|
||||||
, class TAIL
|
, class TAIL
|
||||||
|
|
@ -121,19 +121,19 @@ namespace meta {
|
||||||
struct Append<Node<TY,TYPES>, TAIL> { typedef Node<TY, typename Append<TYPES, TAIL>::List> List; };
|
struct Append<Node<TY,TYPES>, TAIL> { typedef Node<TY, typename Append<TYPES, TAIL>::List> List; };
|
||||||
|
|
||||||
template<class TY, class TYPES>
|
template<class TY, class TYPES>
|
||||||
struct Append<NullType, Node<TY,TYPES>> { typedef Node<TY,TYPES> List; };
|
struct Append<Nil, Node<TY,TYPES>> { typedef Node<TY,TYPES> List; };
|
||||||
|
|
||||||
template<class TY, class TYPES>
|
template<class TY, class TYPES>
|
||||||
struct Append<Node<TY,TYPES>, NullType> { typedef Node<TY,TYPES> List; };
|
struct Append<Node<TY,TYPES>, Nil> { typedef Node<TY,TYPES> List; };
|
||||||
|
|
||||||
template<class TY1>
|
template<class TY1>
|
||||||
struct Append<TY1,NullType> { typedef Node<TY1,NullType> List; };
|
struct Append<TY1,Nil> { typedef Node<TY1,Nil> List; };
|
||||||
|
|
||||||
template<class TY2>
|
template<class TY2>
|
||||||
struct Append<NullType,TY2> { typedef Node<TY2,NullType> List; };
|
struct Append<Nil,TY2> { typedef Node<TY2,Nil> List; };
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct Append<NullType,NullType> { typedef NullType List; };
|
struct Append<Nil,Nil> { typedef Nil List; };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -143,11 +143,11 @@ namespace meta {
|
||||||
struct SplitLast;
|
struct SplitLast;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct SplitLast<NullType> { typedef NullType Type;
|
struct SplitLast<Nil> { typedef Nil Type;
|
||||||
typedef NullType List; };
|
typedef Nil List; };
|
||||||
template<class TY>
|
template<class TY>
|
||||||
struct SplitLast<Node<TY,NullType>> { typedef TY Type;
|
struct SplitLast<Node<TY,Nil>> { typedef TY Type;
|
||||||
typedef NullType List; };
|
typedef Nil List; };
|
||||||
|
|
||||||
template<class TY, class TYPES>
|
template<class TY, class TYPES>
|
||||||
struct SplitLast<Node<TY,TYPES>> { typedef typename SplitLast<TYPES>::Type Type;
|
struct SplitLast<Node<TY,TYPES>> { typedef typename SplitLast<TYPES>::Type Type;
|
||||||
|
|
@ -163,7 +163,7 @@ namespace meta {
|
||||||
* into an base typelist, starting at given index.
|
* into an base typelist, starting at given index.
|
||||||
* @return either the combined (spliced) List, or
|
* @return either the combined (spliced) List, or
|
||||||
* the Front/Back part before or after the Overlay
|
* the Front/Back part before or after the Overlay
|
||||||
* @note using a NullType as OVERLAY allows to extract
|
* @note using a Nil as OVERLAY allows to extract
|
||||||
* an arbitrary Front/Back part of the list
|
* an arbitrary Front/Back part of the list
|
||||||
*/
|
*/
|
||||||
template<class BASE, class OVERLAY, uint i=0>
|
template<class BASE, class OVERLAY, uint i=0>
|
||||||
|
|
@ -178,18 +178,18 @@ namespace meta {
|
||||||
template<class B, class BS,
|
template<class B, class BS,
|
||||||
class O, class OS >
|
class O, class OS >
|
||||||
struct Splice<Node<B,BS>,Node<O,OS>,0> { typedef Node<O, typename Splice<BS,OS, 0>::List> List;
|
struct Splice<Node<B,BS>,Node<O,OS>,0> { typedef Node<O, typename Splice<BS,OS, 0>::List> List;
|
||||||
typedef NullType Front;
|
typedef Nil Front;
|
||||||
typedef typename Splice<BS,OS, 0>::Back Back; };
|
typedef typename Splice<BS,OS, 0>::Back Back; };
|
||||||
|
|
||||||
template<class B, class BS>
|
template<class B, class BS>
|
||||||
struct Splice<Node<B,BS>, NullType, 0> { typedef Node<B, BS> List;
|
struct Splice<Node<B,BS>, Nil, 0> { typedef Node<B, BS> List;
|
||||||
typedef NullType Front;
|
typedef Nil Front;
|
||||||
typedef Node<B, BS> Back; };
|
typedef Node<B, BS> Back; };
|
||||||
|
|
||||||
template<class XX, uint i>
|
template<class XX, uint i>
|
||||||
struct Splice<NullType, XX, i> { typedef NullType List;
|
struct Splice<Nil, XX, i> { typedef Nil List;
|
||||||
typedef NullType Front;
|
typedef Nil Front;
|
||||||
typedef NullType Back; };
|
typedef Nil Back; };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -206,23 +206,23 @@ namespace meta {
|
||||||
{
|
{
|
||||||
typedef Node<T,TYPES> List; ///< the complete list
|
typedef Node<T,TYPES> List; ///< the complete list
|
||||||
typedef T Head; ///< first element
|
typedef T Head; ///< first element
|
||||||
typedef Node<T,NullType> First; ///< a list containing the first element
|
typedef Node<T,Nil> First; ///< a list containing the first element
|
||||||
typedef TYPES Tail; ///< remainder of the list starting with the second elm.
|
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 excluding the last element
|
typedef typename SplitLast<List>::List Prefix;///< all of the list, up to but excluding the last element
|
||||||
typedef typename SplitLast<List>::Type End; ///< the last element
|
typedef typename SplitLast<List>::Type End; ///< the last element
|
||||||
typedef Node<End,NullType> Last; ///< a list containing the last element
|
typedef Node<End,Nil> Last; ///< a list containing the last element
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct Dissect<NullType>
|
struct Dissect<Nil>
|
||||||
{
|
{
|
||||||
typedef NullType List;
|
typedef Nil List;
|
||||||
typedef NullType Head;
|
typedef Nil Head;
|
||||||
typedef NullType First;
|
typedef Nil First;
|
||||||
typedef NullType Tail;
|
typedef Nil Tail;
|
||||||
typedef NullType Prefix;
|
typedef Nil Prefix;
|
||||||
typedef NullType End;
|
typedef Nil End;
|
||||||
typedef NullType Last;
|
typedef Nil Last;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -233,13 +233,13 @@ namespace meta {
|
||||||
* yielding a list-of lists-of-types
|
* yielding a list-of lists-of-types
|
||||||
*/
|
*/
|
||||||
template<class T, class TY>
|
template<class T, class TY>
|
||||||
struct PrefixAll { typedef Node< typename Append<T,TY>::List, NullType> List; };
|
struct PrefixAll { typedef Node< typename Append<T,TY>::List, Nil> List; };
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct PrefixAll<T, NullType> { typedef NullType List; };
|
struct PrefixAll<T, Nil> { typedef Nil List; };
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct PrefixAll<T, NodeNull> { typedef Node< typename Append<T,NodeNull>::List, NullType> List; };
|
struct PrefixAll<T, NilNode> { typedef Node< typename Append<T, NilNode>::List, Nil> List; };
|
||||||
|
|
||||||
template< class T
|
template< class T
|
||||||
, class TY, class TYPES
|
, class TY, class TYPES
|
||||||
|
|
@ -261,7 +261,7 @@ namespace meta {
|
||||||
struct Distribute { typedef typename PrefixAll<TY1,TY2>::List List; };
|
struct Distribute { typedef typename PrefixAll<TY1,TY2>::List List; };
|
||||||
|
|
||||||
template<class TY>
|
template<class TY>
|
||||||
struct Distribute<NullType,TY> { typedef NullType List; };
|
struct Distribute<Nil,TY> { typedef Nil List; };
|
||||||
|
|
||||||
template< class TY, class TYPES
|
template< class TY, class TYPES
|
||||||
, class TAIL
|
, class TAIL
|
||||||
|
|
@ -287,10 +287,10 @@ namespace meta {
|
||||||
template< class X
|
template< class X
|
||||||
, template<class> class _ENUM_>
|
, template<class> class _ENUM_>
|
||||||
struct Combine { typedef typename Distribute< typename _ENUM_<X>::List
|
struct Combine { typedef typename Distribute< typename _ENUM_<X>::List
|
||||||
, Node<NullType,NullType>
|
, Node<Nil,Nil>
|
||||||
>::List List; };
|
>::List List; };
|
||||||
template< template<class> class _ENUM_>
|
template< template<class> class _ENUM_>
|
||||||
struct Combine<NullType, _ENUM_ > { typedef NodeNull List; };
|
struct Combine<Nil, _ENUM_ > { typedef NilNode List; };
|
||||||
|
|
||||||
template< class TY, class TYPES
|
template< class TY, class TYPES
|
||||||
, template<class> class _ENUM_>
|
, template<class> class _ENUM_>
|
||||||
|
|
@ -304,7 +304,7 @@ namespace meta {
|
||||||
template<class F>
|
template<class F>
|
||||||
struct FlagOnOff
|
struct FlagOnOff
|
||||||
{
|
{
|
||||||
typedef Node<F, Node<NullType,NullType>> List;
|
typedef Node<F, Node<Nil,Nil>> List;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ namespace meta {
|
||||||
template<class TYPES>
|
template<class TYPES>
|
||||||
struct count;
|
struct count;
|
||||||
template<>
|
template<>
|
||||||
struct count<NullType>
|
struct count<Nil>
|
||||||
{
|
{
|
||||||
enum{ value = 0 };
|
enum{ value = 0 };
|
||||||
};
|
};
|
||||||
|
|
@ -68,7 +68,7 @@ namespace meta {
|
||||||
template<class TYPES>
|
template<class TYPES>
|
||||||
struct maxSize;
|
struct maxSize;
|
||||||
template<>
|
template<>
|
||||||
struct maxSize<NullType>
|
struct maxSize<Nil>
|
||||||
{
|
{
|
||||||
static constexpr int value = 0;
|
static constexpr int value = 0;
|
||||||
};
|
};
|
||||||
|
|
@ -87,7 +87,7 @@ namespace meta {
|
||||||
template<class TYPES>
|
template<class TYPES>
|
||||||
struct maxAlign;
|
struct maxAlign;
|
||||||
template<>
|
template<>
|
||||||
struct maxAlign<NullType>
|
struct maxAlign<Nil>
|
||||||
{
|
{
|
||||||
static constexpr int value = 0;
|
static constexpr int value = 0;
|
||||||
};
|
};
|
||||||
|
|
@ -138,15 +138,15 @@ namespace meta {
|
||||||
struct ConstAll;
|
struct ConstAll;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct ConstAll<NullType>
|
struct ConstAll<Nil>
|
||||||
{
|
{
|
||||||
typedef NullType List;
|
using List = Nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename TY, typename TYPES>
|
template<typename TY, typename TYPES>
|
||||||
struct ConstAll<Node<TY,TYPES>>
|
struct ConstAll<Node<TY,TYPES>>
|
||||||
{
|
{
|
||||||
typedef Node<const TY, typename ConstAll<TYPES>::List> List;
|
using List = Node<const TY, typename ConstAll<TYPES>::List>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,16 @@ This code is heavily inspired by
|
||||||
/** @file typelist.hpp
|
/** @file typelist.hpp
|
||||||
** A template metaprogramming technique for manipulating collections of types.
|
** A template metaprogramming technique for manipulating collections of types.
|
||||||
** Effectively this is a tailored and simplified version of what can be found in the Loki library.
|
** Effectively this is a tailored and simplified version of what can be found in the Loki library.
|
||||||
** We use it in other generic library-style code to generate repetitive code. If you tend to find
|
** We use it in other generic library-style code to generate repetitive code.
|
||||||
** template metaprogramming (or functional programming in general) offending, please ignore the
|
** @remark If you tend to find the use of template metaprogramming detrimental
|
||||||
** technical details and just consider the benefit of such an simplification for the client code.
|
** (or functional programming and generally any kind of abstraction)
|
||||||
|
** please kindly ignore the technical details and just consider the
|
||||||
|
** benefit of simplification for the client code.
|
||||||
**
|
**
|
||||||
** Interface for using this facility is the template Types(.....) for up to 20 Type parameters.
|
** Interface for using this facility is the template `Types<TS...>`.
|
||||||
** To start typelist processing, other templates typically pick up the Types<...>::List type.
|
** To start typelist processing, other templates typically pick up the Types<...>::List type.
|
||||||
** This allows for LISP-style list processing, with a pattern match on either Node<TY,TYPES>
|
** This allows for LISP-style list processing, with a pattern match on either `Node<TY,TYPES>`
|
||||||
** or NullType to terminate recursion. In C++ template metaprogramming, "pattern match"
|
** or the type `Nil` to terminate recursion. In C++ template metaprogramming, "pattern match"
|
||||||
** is done by partial template specialisations (the compiler will pick up and thus
|
** is done by partial template specialisations (the compiler will pick up and thus
|
||||||
** match the template parameters). A typedef acts like a declaration in normal
|
** match the template parameters). A typedef acts like a declaration in normal
|
||||||
** programming. Because such a "declaration" can't be changed after the fact,
|
** programming. Because such a "declaration" can't be changed after the fact,
|
||||||
|
|
@ -74,44 +76,44 @@ This code is heavily inspired by
|
||||||
namespace lib {
|
namespace lib {
|
||||||
namespace meta {
|
namespace meta {
|
||||||
|
|
||||||
struct NullType
|
struct Nil
|
||||||
{
|
{
|
||||||
typedef NullType List;
|
using List = Nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class H, class T>
|
template<class H, class T>
|
||||||
struct Node
|
struct Node
|
||||||
{
|
{
|
||||||
typedef Node List;
|
using List = Node;
|
||||||
typedef H Head;
|
using Head = H;
|
||||||
typedef T Tail;
|
using Tail = T;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Node<NullType,NullType> NodeNull;
|
using NilNode = Node<Nil,Nil>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template
|
template
|
||||||
< class T01=NullType
|
< class T01=Nil
|
||||||
, class T02=NullType
|
, class T02=Nil
|
||||||
, class T03=NullType
|
, class T03=Nil
|
||||||
, class T04=NullType
|
, class T04=Nil
|
||||||
, class T05=NullType
|
, class T05=Nil
|
||||||
, class T06=NullType
|
, class T06=Nil
|
||||||
, class T07=NullType
|
, class T07=Nil
|
||||||
, class T08=NullType
|
, class T08=Nil
|
||||||
, class T09=NullType
|
, class T09=Nil
|
||||||
, class T10=NullType
|
, class T10=Nil
|
||||||
, class T11=NullType
|
, class T11=Nil
|
||||||
, class T12=NullType
|
, class T12=Nil
|
||||||
, class T13=NullType
|
, class T13=Nil
|
||||||
, class T14=NullType
|
, class T14=Nil
|
||||||
, class T15=NullType
|
, class T15=Nil
|
||||||
, class T16=NullType
|
, class T16=Nil
|
||||||
, class T17=NullType
|
, class T17=Nil
|
||||||
, class T18=NullType
|
, class T18=Nil
|
||||||
, class T19=NullType
|
, class T19=Nil
|
||||||
, class T20=NullType
|
, class T20=Nil
|
||||||
>
|
>
|
||||||
class TyOLD
|
class TyOLD
|
||||||
{
|
{
|
||||||
|
|
@ -128,7 +130,7 @@ namespace meta {
|
||||||
template<>
|
template<>
|
||||||
struct TyOLD<>
|
struct TyOLD<>
|
||||||
{
|
{
|
||||||
using List = NullType;
|
using List = Nil;
|
||||||
using Seq = TyOLD<>;
|
using Seq = TyOLD<>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -139,9 +141,9 @@ namespace meta {
|
||||||
* alternative definition of "type sequence",
|
* alternative definition of "type sequence",
|
||||||
* already using variadic template parameters.
|
* already using variadic template parameters.
|
||||||
* @remarks the problem with our existing type sequence type
|
* @remarks the problem with our existing type sequence type
|
||||||
* is that it fills the end of each sequence with NullType,
|
* is that it fills the end of each sequence with Nil,
|
||||||
* which was the only way to get a flexible type sequence
|
* which was the only way to get a flexible type sequence
|
||||||
* prior to C++11. Unfortunately these trailing NullType
|
* prior to C++11. Unfortunately these trailing Nil
|
||||||
* entries do not play well with other variadic defs.
|
* entries do not play well with other variadic defs.
|
||||||
* @deprecated when we switch our primary type sequence type
|
* @deprecated when we switch our primary type sequence type
|
||||||
* to variadic parameters, this type will be obsoleted. ////////////////////////////////////TICKET #987 : make lib::meta::Types<TYPES...> variadic
|
* to variadic parameters, this type will be obsoleted. ////////////////////////////////////TICKET #987 : make lib::meta::Types<TYPES...> variadic
|
||||||
|
|
|
||||||
|
|
@ -166,16 +166,16 @@ namespace meta {
|
||||||
>::Seq;
|
>::Seq;
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct TySeq<NullType>
|
struct TySeq<Nil>
|
||||||
{
|
{
|
||||||
using List = NullType;
|
using List = Nil;
|
||||||
using Seq = TySeq<>;
|
using Seq = TySeq<>;
|
||||||
};
|
};
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND -- to be obsoleted
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND -- to be obsoleted
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* temporary workaround: strip trailing NullType entries from a
|
* temporary workaround: strip trailing Nil entries from a
|
||||||
* type sequence, to make it compatible with new-style variadic
|
* type sequence, to make it compatible with new-style variadic
|
||||||
* template definitions.
|
* template definitions.
|
||||||
* @note the result type is a TySec, to keep it apart from our
|
* @note the result type is a TySec, to keep it apart from our
|
||||||
|
|
@ -183,24 +183,24 @@ namespace meta {
|
||||||
* @deprecated necessary for the transition to variadic sequences ////////////////////////////////////TICKET #987 : make lib::meta::Types<TYPES...> variadic
|
* @deprecated necessary for the transition to variadic sequences ////////////////////////////////////TICKET #987 : make lib::meta::Types<TYPES...> variadic
|
||||||
*/
|
*/
|
||||||
template<typename SEQ>
|
template<typename SEQ>
|
||||||
struct StripNullType;
|
struct StripNil;
|
||||||
|
|
||||||
template<typename T, typename...TYPES>
|
template<typename T, typename...TYPES>
|
||||||
struct StripNullType<TyOLD<T,TYPES...>>
|
struct StripNil<TyOLD<T,TYPES...>>
|
||||||
{
|
{
|
||||||
using TailSeq = typename StripNullType<TyOLD<TYPES...>>::Seq;
|
using TailSeq = typename StripNil<TyOLD<TYPES...>>::Seq;
|
||||||
|
|
||||||
using Seq = typename Prepend<T, TailSeq>::Seq;
|
using Seq = typename Prepend<T, TailSeq>::Seq;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename...TYPES>
|
template<typename...TYPES>
|
||||||
struct StripNullType<TyOLD<NullType, TYPES...>>
|
struct StripNil<TyOLD<Nil, TYPES...>>
|
||||||
{
|
{
|
||||||
using Seq = TySeq<>; // NOTE: this causes the result to be a TySeq
|
using Seq = TySeq<>; // NOTE: this causes the result to be a TySeq
|
||||||
};
|
};
|
||||||
///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation is a catch-all and becomes obsolete
|
///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation is a catch-all and becomes obsolete
|
||||||
template<typename...TYPES>
|
template<typename...TYPES>
|
||||||
struct StripNullType<TySeq<TYPES...>>
|
struct StripNil<TySeq<TYPES...>>
|
||||||
{
|
{
|
||||||
using Seq = TySeq<TYPES...>;
|
using Seq = TySeq<TYPES...>;
|
||||||
};
|
};
|
||||||
|
|
@ -237,20 +237,20 @@ namespace meta {
|
||||||
template<>
|
template<>
|
||||||
struct Split<TySeq<>>
|
struct Split<TySeq<>>
|
||||||
{
|
{
|
||||||
using List = NullType;
|
using List = Nil;
|
||||||
|
|
||||||
using Head = NullType;
|
using Head = Nil;
|
||||||
using First = TySeq<>;
|
using First = TySeq<>;
|
||||||
using Tail = TySeq<>;
|
using Tail = TySeq<>;
|
||||||
|
|
||||||
// for finding the end we need the help of typelist-util.hpp
|
// for finding the end we need the help of typelist-util.hpp
|
||||||
|
|
||||||
using PrefixList = NullType;
|
using PrefixList = Nil;
|
||||||
using TailList = NullType;
|
using TailList = Nil;
|
||||||
|
|
||||||
using Prefix = TySeq<>;
|
using Prefix = TySeq<>;
|
||||||
using Last = TySeq<>;
|
using Last = TySeq<>;
|
||||||
using End = NullType;
|
using End = Nil;
|
||||||
};
|
};
|
||||||
///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation will be obsoleted by the removal of old-style type-sequences
|
///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation will be obsoleted by the removal of old-style type-sequences
|
||||||
template< typename T01
|
template< typename T01
|
||||||
|
|
@ -309,7 +309,7 @@ namespace meta {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper: generate a type sequence left shifted
|
* Helper: generate a type sequence left shifted
|
||||||
* by i steps, filling in NullType at the end
|
* by i steps, filling in Nil at the end
|
||||||
*/
|
*/
|
||||||
template<class TYPES, uint i=1>
|
template<class TYPES, uint i=1>
|
||||||
class Shifted
|
class Shifted
|
||||||
|
|
@ -326,6 +326,7 @@ namespace meta {
|
||||||
typedef TYPES Type;
|
typedef TYPES Type;
|
||||||
typedef typename Split<Type>::Head Head;
|
typedef typename Split<Type>::Head Head;
|
||||||
};
|
};
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////TICKET #987 : reimplement for variadic type-sequences
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ namespace meta {
|
||||||
template<typename...TYPES>
|
template<typename...TYPES>
|
||||||
struct BuildIdxIter<TyOLD<TYPES...>>
|
struct BuildIdxIter<TyOLD<TYPES...>>
|
||||||
{
|
{
|
||||||
///////////////////////TICKET #987 : since Types<T...> is not variadic, need to strip NullType here (instead of just using sizeof...(TYPES)
|
///////////////////////TICKET #987 : since Types<T...> is not variadic, need to strip Nil-Type here (instead of just using sizeof...(TYPES)
|
||||||
enum {SIZ = lib::meta::count<typename TyOLD<TYPES...>::List>::value };
|
enum {SIZ = lib::meta::count<typename TyOLD<TYPES...>::List>::value };
|
||||||
using Builder = BuildIndexSeq<SIZ>;
|
using Builder = BuildIndexSeq<SIZ>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ namespace meta {
|
||||||
* A secondary helper template variant is provided for rebinding
|
* A secondary helper template variant is provided for rebinding
|
||||||
* while prepending or appending a single type parameter.
|
* while prepending or appending a single type parameter.
|
||||||
* @note does not work with empty sequences; also the penultimate
|
* @note does not work with empty sequences; also the penultimate
|
||||||
* of a one-element sequence is mapped to NullType
|
* of a one-element sequence is mapped to the `Nil`-type
|
||||||
*/
|
*/
|
||||||
template<template<class...> class L, typename...XS>
|
template<template<class...> class L, typename...XS>
|
||||||
struct _Vari;
|
struct _Vari;
|
||||||
|
|
@ -129,7 +129,7 @@ namespace meta {
|
||||||
struct _Vari<L, X>
|
struct _Vari<L, X>
|
||||||
{
|
{
|
||||||
using Ultima = X;
|
using Ultima = X;
|
||||||
using Penult = NullType; ///< marker for undefined
|
using Penult = Nil; ///< marker for undefined
|
||||||
using Remain = L<X>;
|
using Remain = L<X>;
|
||||||
using Revers = L<X>;
|
using Revers = L<X>;
|
||||||
using Prefix = L<>;
|
using Prefix = L<>;
|
||||||
|
|
|
||||||
|
|
@ -162,8 +162,8 @@ namespace util {
|
||||||
using std::optional;
|
using std::optional;
|
||||||
using lib::meta::_Fun;
|
using lib::meta::_Fun;
|
||||||
using lib::meta::has_Sig;
|
using lib::meta::has_Sig;
|
||||||
using lib::meta::NullType;
|
|
||||||
using lib::meta::_Vari;
|
using lib::meta::_Vari;
|
||||||
|
using lib::meta::Nil;
|
||||||
using std::decay_t;
|
using std::decay_t;
|
||||||
using std::tuple;
|
using std::tuple;
|
||||||
using std::array;
|
using std::array;
|
||||||
|
|
@ -221,14 +221,14 @@ namespace util {
|
||||||
|
|
||||||
/** »Null-Connex« which always successfully accepts the empty sequence */
|
/** »Null-Connex« which always successfully accepts the empty sequence */
|
||||||
inline auto
|
inline auto
|
||||||
buildConnex(NullType)
|
buildConnex(Nil)
|
||||||
{
|
{
|
||||||
return Connex{[](StrView) -> Eval<NullType>
|
return Connex{[](StrView) -> Eval<Nil>
|
||||||
{
|
{
|
||||||
return {NullType{}};
|
return {Nil()};
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
using NulP = decltype(buildConnex (NullType()));
|
using NulP = decltype(buildConnex (Nil()));
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -729,7 +729,7 @@ namespace util {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* === Deduction guide : how to construct a Parser === */
|
/* === Deduction guide : how to construct a Parser === */
|
||||||
Parser(NullType) -> Parser<NulP>;
|
Parser(Nil) -> Parser<NulP>;
|
||||||
Parser(regex &&) -> Parser<Term>;
|
Parser(regex &&) -> Parser<Term>;
|
||||||
Parser(regex const&) -> Parser<Term>;
|
Parser(regex const&) -> Parser<Term>;
|
||||||
Parser(string const&) -> Parser<Term>;
|
Parser(string const&) -> Parser<Term>;
|
||||||
|
|
@ -787,7 +787,7 @@ namespace util {
|
||||||
using Result = typename PAR::Result;
|
using Result = typename PAR::Result;
|
||||||
|
|
||||||
Syntax()
|
Syntax()
|
||||||
: parse_{NullType()}
|
: parse_{Nil()}
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
|
|
@ -948,21 +948,21 @@ namespace util {
|
||||||
inline auto
|
inline auto
|
||||||
accept_repeated (uint min, uint max, SPEC&& clauseDef)
|
accept_repeated (uint min, uint max, SPEC&& clauseDef)
|
||||||
{
|
{
|
||||||
return accept_repeated (min, max, NullType{}, forward<SPEC>(clauseDef));
|
return accept_repeated (min, max, Nil{}, forward<SPEC>(clauseDef));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename SPEC>
|
template<typename SPEC>
|
||||||
inline auto
|
inline auto
|
||||||
accept_repeated (uint cnt, SPEC&& clauseDef)
|
accept_repeated (uint cnt, SPEC&& clauseDef)
|
||||||
{
|
{
|
||||||
return accept_repeated (cnt, NullType{}, forward<SPEC>(clauseDef));
|
return accept_repeated (cnt, Nil{}, forward<SPEC>(clauseDef));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename SPEC>
|
template<typename SPEC>
|
||||||
inline auto
|
inline auto
|
||||||
accept_repeated (SPEC&& clauseDef)
|
accept_repeated (SPEC&& clauseDef)
|
||||||
{
|
{
|
||||||
return accept_repeated (NullType{}, forward<SPEC>(clauseDef));
|
return accept_repeated (Nil{}, forward<SPEC>(clauseDef));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ namespace time {
|
||||||
|
|
||||||
using lib::meta::TyOLD;
|
using lib::meta::TyOLD;
|
||||||
using lib::meta::Node;
|
using lib::meta::Node;
|
||||||
using lib::meta::NullType;
|
using lib::meta::Nil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Descriptor to denote support for a specific (timecode) format.
|
* Descriptor to denote support for a specific (timecode) format.
|
||||||
|
|
@ -204,9 +204,9 @@ namespace time {
|
||||||
flags_.set (typeID<F>());
|
flags_.set (typeID<F>());
|
||||||
return define(FS());
|
return define(FS());
|
||||||
}
|
}
|
||||||
Supported define(NullType) { return *this;} ///< @internal recursion end
|
Supported define(Nil) { return *this;} ///< @internal recursion end
|
||||||
|
|
||||||
Supported() { } ///< @note use #formats to set up a new descriptor
|
Supported() { } ///< @note use #formats to set up a new descriptor
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -98,9 +98,9 @@ namespace lib {
|
||||||
namespace variant { // implementation metaprogramming helpers
|
namespace variant { // implementation metaprogramming helpers
|
||||||
|
|
||||||
using std::remove_reference;
|
using std::remove_reference;
|
||||||
using meta::NullType;
|
|
||||||
using meta::TyOLD;
|
using meta::TyOLD;
|
||||||
using meta::Node;
|
using meta::Node;
|
||||||
|
using meta::Nil;
|
||||||
|
|
||||||
|
|
||||||
template<typename X, typename TYPES>
|
template<typename X, typename TYPES>
|
||||||
|
|
@ -137,7 +137,7 @@ namespace lib {
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
template<typename X>
|
template<typename X>
|
||||||
struct CanBuildFrom<X, NullType>
|
struct CanBuildFrom<X, Nil>
|
||||||
: std::false_type
|
: std::false_type
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ namespace visitor {
|
||||||
< class TOOLImpl,
|
< class TOOLImpl,
|
||||||
class BASE
|
class BASE
|
||||||
>
|
>
|
||||||
class Applicable<TOOLImpl, typelist::NullType, BASE>
|
class Applicable<TOOLImpl, typelist::Nil, BASE>
|
||||||
: public BASE
|
: public BASE
|
||||||
{ }
|
{ }
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ namespace control {
|
||||||
using lib::Symbol;
|
using lib::Symbol;
|
||||||
|
|
||||||
using lib::meta::_Fun;
|
using lib::meta::_Fun;
|
||||||
using lib::meta::NullType;
|
|
||||||
using lib::meta::TyOLD;
|
using lib::meta::TyOLD;
|
||||||
using lib::meta::Tuple;
|
using lib::meta::Tuple;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ namespace control {
|
||||||
using lib::meta::Tuple;
|
using lib::meta::Tuple;
|
||||||
using lib::meta::BuildTupleAccessor;
|
using lib::meta::BuildTupleAccessor;
|
||||||
using lib::meta::func::TupleApplicator;
|
using lib::meta::func::TupleApplicator;
|
||||||
using lib::meta::NullType;
|
|
||||||
using lib::meta::buildTuple;
|
using lib::meta::buildTuple;
|
||||||
|
using lib::meta::Nil;
|
||||||
|
|
||||||
using lib::TypedAllocationManager;
|
using lib::TypedAllocationManager;
|
||||||
using std::function;
|
using std::function;
|
||||||
|
|
@ -94,7 +94,7 @@ namespace control {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class TUP, uint n>
|
template<class TUP, uint n>
|
||||||
class ParamAccessor<NullType, TUP, TUP, n> ///< used for recursion end of implementation functions
|
class ParamAccessor<Nil, TUP, TUP, n> ///< used for recursion end of implementation functions
|
||||||
: public TUP
|
: public TUP
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,9 @@ namespace engine {
|
||||||
using lib::meta::is_Structured;
|
using lib::meta::is_Structured;
|
||||||
using lib::meta::forEachIDX;
|
using lib::meta::forEachIDX;
|
||||||
using lib::meta::ElmTypes;
|
using lib::meta::ElmTypes;
|
||||||
using lib::meta::NullType;
|
|
||||||
using lib::meta::Tagged;
|
using lib::meta::Tagged;
|
||||||
using lib::meta::TySeq;
|
using lib::meta::TySeq;
|
||||||
|
using lib::meta::Nil;
|
||||||
using std::is_pointer;
|
using std::is_pointer;
|
||||||
using std::is_reference;
|
using std::is_reference;
|
||||||
using std::is_convertible;
|
using std::is_convertible;
|
||||||
|
|
@ -372,7 +372,7 @@ namespace engine {
|
||||||
using enable_if_hasParam = typename lib::meta::enable_if_c<_ProcFun<F>::hasParam()>::type;
|
using enable_if_hasParam = typename lib::meta::enable_if_c<_ProcFun<F>::hasParam()>::type;
|
||||||
|
|
||||||
template<class X>
|
template<class X>
|
||||||
using NotProvided = Tagged<NullType, X>;
|
using NotProvided = Tagged<Nil, X>;
|
||||||
|
|
||||||
template<bool yes, class B>
|
template<bool yes, class B>
|
||||||
using Provide_if = conditional_t<yes, B, NotProvided<B>>;
|
using Provide_if = conditional_t<yes, B, NotProvided<B>>;
|
||||||
|
|
|
||||||
|
|
@ -65,11 +65,11 @@ namespace engine {
|
||||||
|
|
||||||
/* ===== Parse nested spec ===== */
|
/* ===== Parse nested spec ===== */
|
||||||
|
|
||||||
|
using lib::meta::Nil;
|
||||||
using util::parse::accept;
|
using util::parse::accept;
|
||||||
using util::parse::accept_bracket;
|
using util::parse::accept_bracket;
|
||||||
using util::parse::accept_repeated;
|
using util::parse::accept_repeated;
|
||||||
using util::parse::expectResult;
|
using util::parse::expectResult;
|
||||||
using lib::meta::NullType;
|
|
||||||
using std::regex_match;
|
using std::regex_match;
|
||||||
using std::regex;
|
using std::regex;
|
||||||
|
|
||||||
|
|
@ -91,13 +91,13 @@ namespace engine {
|
||||||
regex CLOSING{esc+CLO};
|
regex CLOSING{esc+CLO};
|
||||||
regex NON_PAREN{R"_([^\\)_"+esc+OPE+esc+CLO+"]+"};
|
regex NON_PAREN{R"_([^\\)_"+esc+OPE+esc+CLO+"]+"};
|
||||||
|
|
||||||
static auto paren = expectResult<NullType>();
|
static auto paren = expectResult<Nil>();
|
||||||
auto parenContent = accept_repeated(accept(NON_PAREN)
|
auto parenContent = accept_repeated(accept(NON_PAREN)
|
||||||
.alt(ESCAPE)
|
.alt(ESCAPE)
|
||||||
.alt(quote)
|
.alt(quote)
|
||||||
.alt(paren));
|
.alt(paren));
|
||||||
|
|
||||||
paren = accept_bracket(OPENING,CLOSING, parenContent).bind([](auto){ return NullType{}; });
|
paren = accept_bracket(OPENING,CLOSING, parenContent).bind([](auto){ return Nil{}; });
|
||||||
return paren;
|
return paren;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -403,7 +403,7 @@ namespace engine {
|
||||||
|
|
||||||
namespace {// create a »backdoor access« into actual weaving-pattern instances
|
namespace {// create a »backdoor access« into actual weaving-pattern instances
|
||||||
|
|
||||||
using _DummyProc = void(&)(NullType*);
|
using _DummyProc = void(&)(Nil*);
|
||||||
using _DummyProto = FeedPrototype<_DummyProc>;
|
using _DummyProto = FeedPrototype<_DummyProc>;
|
||||||
using _DummyMediaWeaving = MediaWeavingPattern<_DummyProto>;
|
using _DummyMediaWeaving = MediaWeavingPattern<_DummyProto>;
|
||||||
using _RecastMediaWeaving = _TurnoutDiagnostic<_DummyMediaWeaving>;
|
using _RecastMediaWeaving = _TurnoutDiagnostic<_DummyMediaWeaving>;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace session {
|
||||||
|
|
||||||
// using lib::meta::InstantiateChained;
|
// using lib::meta::InstantiateChained;
|
||||||
// using lib::meta::InheritFrom;
|
// using lib::meta::InheritFrom;
|
||||||
// using lib::meta::NullType;
|
// using lib::meta::Nil;
|
||||||
|
|
||||||
|
|
||||||
class SessionServiceDefaults
|
class SessionServiceDefaults
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ namespace session {
|
||||||
|
|
||||||
// using lib::meta::InstantiateChained;
|
// using lib::meta::InstantiateChained;
|
||||||
// using lib::meta::InheritFrom;
|
// using lib::meta::InheritFrom;
|
||||||
// using lib::meta::NullType;
|
// using lib::meta::Nil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation-level service for resolving an Placement-ID.
|
* Implementation-level service for resolving an Placement-ID.
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ namespace test{
|
||||||
CHECK (x2 == "Φ"_expect);
|
CHECK (x2 == "Φ"_expect);
|
||||||
|
|
||||||
// auto& [z0,z1,z2,z3] = chain2; // Error: 4 names provided for structured binding, while HeteroData... decomposes into 3 elements
|
// auto& [z0,z1,z2,z3] = chain2; // Error: 4 names provided for structured binding, while HeteroData... decomposes into 3 elements
|
||||||
// auto& [z0,z1,z2] = b1; // Error: HeteroData<Node<StorageFrame<0, uint>, NullType> >' decomposes into 1 element
|
// auto& [z0,z1,z2] = b1; // Error: HeteroData<Node<StorageFrame<0, uint>, Nil> >' decomposes into 1 element
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ namespace test {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct TestCase<void,void,NullType>
|
struct TestCase<void,void,Nil>
|
||||||
{
|
{
|
||||||
static string
|
static string
|
||||||
visitAll()
|
visitAll()
|
||||||
|
|
@ -76,7 +76,7 @@ namespace test {
|
||||||
return "-|";
|
return "-|";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
typedef TestCase<void,void,NullType> IterationEnd;
|
typedef TestCase<void,void,Nil> IterationEnd;
|
||||||
|
|
||||||
} // (End) test data
|
} // (End) test data
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ namespace test {
|
||||||
CHECK ((not is_Structured<int const && >()));
|
CHECK ((not is_Structured<int const && >()));
|
||||||
CHECK ((not is_Structured<double >()));
|
CHECK ((not is_Structured<double >()));
|
||||||
CHECK ((not is_Structured<string >()));
|
CHECK ((not is_Structured<string >()));
|
||||||
CHECK ((not is_Structured<Node<short,NullType> >()));
|
CHECK ((not is_Structured<Node<short,Nil> >()));
|
||||||
|
|
||||||
// the following indeed support C++ tuple protocol
|
// the following indeed support C++ tuple protocol
|
||||||
CHECK (( is_Structured<tuple<int> >()));
|
CHECK (( is_Structured<tuple<int> >()));
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,8 @@ namespace test {
|
||||||
Prepend prep (22, 11,33,Num<5>());
|
Prepend prep (22, 11,33,Num<5>());
|
||||||
DUMPVAL (prep);
|
DUMPVAL (prep);
|
||||||
|
|
||||||
typedef Tuple<TyOLD<> > NulT; // plain-flat empty Tuple
|
using NulT = Tuple<TyOLD<> >; // plain-flat empty Tuple
|
||||||
typedef Tuple<NullType> NulL; // list-style empty Tuple
|
using NulL = Tuple<Nil>; // list-style empty Tuple
|
||||||
|
|
||||||
NulT nulT; // and these, too, can be instantiated
|
NulT nulT; // and these, too, can be instantiated
|
||||||
NulL nulL;
|
NulL nulL;
|
||||||
|
|
@ -139,7 +139,7 @@ namespace test {
|
||||||
CHECK (is_Tuple<T_L1>());
|
CHECK (is_Tuple<T_L1>());
|
||||||
CHECK (is_Tuple<Prepend>());
|
CHECK (is_Tuple<Prepend>());
|
||||||
CHECK (is_Tuple<NulT>());
|
CHECK (is_Tuple<NulT>());
|
||||||
CHECK (!is_Tuple<Seq1>());
|
CHECK (not is_Tuple<Seq1>());
|
||||||
|
|
||||||
cout << tup1 <<endl // these automatically use our generic string conversion
|
cout << tup1 <<endl // these automatically use our generic string conversion
|
||||||
<< prep <<endl
|
<< prep <<endl
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,8 @@ namespace meta {
|
||||||
|
|
||||||
|
|
||||||
/** helper for generating test lists */
|
/** helper for generating test lists */
|
||||||
template<class X> struct CountDown { typedef NullType List; };
|
template<class X> struct CountDown { typedef Nil List; };
|
||||||
template<> struct CountDown<Num<0>> { typedef Node<Num<0>, NullType> List; };
|
template<> struct CountDown<Num<0>> { typedef Node<Num<0>, Nil> List; };
|
||||||
template<int I> struct CountDown<Num<I>> { typedef Node<Num<I>, typename CountDown<Num<I-1>>::List> List; };
|
template<int I> struct CountDown<Num<I>> { typedef Node<Num<I>, typename CountDown<Num<I-1>>::List> List; };
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ namespace meta {
|
||||||
/** debugging template,
|
/** debugging template,
|
||||||
* printing the "number" used for instantiation on ctor call
|
* printing the "number" used for instantiation on ctor call
|
||||||
*/
|
*/
|
||||||
template<class T=NullType, class BASE=NullP>
|
template<class T=Nil, class BASE=NullP>
|
||||||
struct Printer
|
struct Printer
|
||||||
: BASE
|
: BASE
|
||||||
{
|
{
|
||||||
|
|
@ -109,7 +109,7 @@ namespace meta {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class BASE>
|
template<class BASE>
|
||||||
struct Printer<NullType, BASE>
|
struct Printer<Nil, BASE>
|
||||||
: BASE
|
: BASE
|
||||||
{
|
{
|
||||||
static string print () { return _Fmt("-<%u>%s") % "·" % BASE::print(); }
|
static string print () { return _Fmt("-<%u>%s") % "·" % BASE::print(); }
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ namespace test {
|
||||||
* @test check utilities for manipulating lists-of-types.
|
* @test check utilities for manipulating lists-of-types.
|
||||||
* - build an list of constant-wrapper-types and
|
* - build an list of constant-wrapper-types and
|
||||||
* print them for debugging purpose.
|
* print them for debugging purpose.
|
||||||
* - append lists, single elements and NullType
|
* - append lists, single elements and Nil-Type
|
||||||
* in various combinations
|
* in various combinations
|
||||||
* - manipulations like splice, get end, dissect
|
* - manipulations like splice, get end, dissect
|
||||||
* - filtering out some types from a typelist by
|
* - filtering out some types from a typelist by
|
||||||
|
|
@ -124,48 +124,48 @@ namespace test {
|
||||||
Pick<List2,1>::Type e1;
|
Pick<List2,1>::Type e1;
|
||||||
Pick<List2,2>::Type e2;
|
Pick<List2,2>::Type e2;
|
||||||
|
|
||||||
typedef Pick<List2,3>::Type E3;
|
using E3 = Pick<List2,3>::Type;
|
||||||
typedef Pick<NullType,23>::Type Nil;
|
using NilE = Pick<Nil, 23>::Type;
|
||||||
typedef Pick<void*,456>::Type Irrelevant;
|
using Irrelevant = Pick<void*,456>::Type;
|
||||||
|
|
||||||
CHECK (5 == e0);
|
CHECK (5 == e0);
|
||||||
CHECK (6 == e1);
|
CHECK (6 == e1);
|
||||||
CHECK (7 == e2);
|
CHECK (7 == e2);
|
||||||
|
|
||||||
CHECK ((is_same<NullType, E3> ::value));
|
CHECK ((is_same<Nil, E3> ::value));
|
||||||
CHECK ((is_same<NullType, Nil> ::value));
|
CHECK ((is_same<Nil, NilE> ::value));
|
||||||
CHECK ((is_same<NullType, Irrelevant>::value));
|
CHECK ((is_same<Nil, Irrelevant>::value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
check_append ()
|
check_append ()
|
||||||
{
|
{
|
||||||
typedef Append<NullType, NullType> Append1;
|
using Append1 = Append<Nil, Nil>;
|
||||||
DISPLAY (Append1);
|
DISPLAY (Append1);
|
||||||
|
|
||||||
typedef Append<Num<11>,Num<22>> Append2;
|
using Append2 = Append<Num<11>,Num<22>>;
|
||||||
DISPLAY (Append2);
|
DISPLAY (Append2);
|
||||||
|
|
||||||
typedef Append<Num<111>,NullType> Append3;
|
using Append3 = Append<Num<111>,Nil>;
|
||||||
DISPLAY (Append3);
|
DISPLAY (Append3);
|
||||||
|
|
||||||
typedef Append<NullType,Num<222>> Append4;
|
using Append4 = Append<Nil,Num<222>>;
|
||||||
DISPLAY (Append4);
|
DISPLAY (Append4);
|
||||||
|
|
||||||
typedef Append<List1,NullType> Append5;
|
using Append5 = Append<List1,Nil>;
|
||||||
DISPLAY (Append5);
|
DISPLAY (Append5);
|
||||||
|
|
||||||
typedef Append<NullType,List2> Append6;
|
using Append6 = Append<Nil,List2>;
|
||||||
DISPLAY (Append6);
|
DISPLAY (Append6);
|
||||||
|
|
||||||
typedef Append<Num<111>,List2> Append7;
|
using Append7 = Append<Num<111>,List2>;
|
||||||
DISPLAY (Append7);
|
DISPLAY (Append7);
|
||||||
|
|
||||||
typedef Append<List1,Num<222>> Append8;
|
using Append8 = Append<List1,Num<222>>;
|
||||||
DISPLAY (Append8);
|
DISPLAY (Append8);
|
||||||
|
|
||||||
typedef Append<List1,List2> Append9;
|
using Append9 = Append<List1,List2>;
|
||||||
DISPLAY (Append9);
|
DISPLAY (Append9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,66 +173,66 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_splice ()
|
check_splice ()
|
||||||
{
|
{
|
||||||
typedef TyOLD<Num<9>,Num<8>>::List OLi;
|
using OLi = TyOLD<Num<9>,Num<8>>::List;
|
||||||
// will "paste" the list OLi "on top" of another Typelist...
|
// will "paste" the list OLi "on top" of another Typelist...
|
||||||
|
|
||||||
typedef Splice<NullType, NullType> Overl01;
|
using Overl01 = Splice<Nil, Nil>;
|
||||||
DISPLAY (Overl01);
|
DISPLAY (Overl01);
|
||||||
|
|
||||||
typedef Splice<NullType, OLi> Overl02;
|
using Overl02 = Splice<Nil, OLi>;
|
||||||
DISPLAY (Overl02);
|
DISPLAY (Overl02);
|
||||||
|
|
||||||
typedef Splice<NullType, OLi, 5> Overl03;
|
using Overl03 = Splice<Nil, OLi, 5>;
|
||||||
DISPLAY (Overl03);
|
DISPLAY (Overl03);
|
||||||
|
|
||||||
typedef Splice<List1, OLi> Overl04;
|
using Overl04 = Splice<List1, OLi>;
|
||||||
DISPLAY (Overl04);
|
DISPLAY (Overl04);
|
||||||
|
|
||||||
typedef Splice<List1, OLi, 1> Overl05;
|
using Overl05 = Splice<List1, OLi, 1>;
|
||||||
DISPLAY (Overl05);
|
DISPLAY (Overl05);
|
||||||
|
|
||||||
typedef Splice<List1, OLi, 2> Overl06;
|
using Overl06 = Splice<List1, OLi, 2>;
|
||||||
DISPLAY (Overl06);
|
DISPLAY (Overl06);
|
||||||
|
|
||||||
typedef Splice<List1, OLi, 3> Overl07;
|
using Overl07 = Splice<List1, OLi, 3>;
|
||||||
DISPLAY (Overl07);
|
DISPLAY (Overl07);
|
||||||
|
|
||||||
typedef Splice<List1, OLi, 5> Overl08;
|
using Overl08 = Splice<List1, OLi, 5>;
|
||||||
DISPLAY (Overl08);
|
DISPLAY (Overl08);
|
||||||
|
|
||||||
typedef Splice<List1, List1> Overl09;
|
using Overl09 = Splice<List1, List1>;
|
||||||
DISPLAY (Overl09);
|
DISPLAY (Overl09);
|
||||||
|
|
||||||
typedef Splice<List1, List1, 1> Overl10;
|
using Overl10 = Splice<List1, List1, 1>;
|
||||||
DISPLAY (Overl10);
|
DISPLAY (Overl10);
|
||||||
|
|
||||||
typedef Splice<List1, NullType> Overl11;
|
using Overl11 = Splice<List1, Nil>;
|
||||||
DISPLAY (Overl11);
|
DISPLAY (Overl11);
|
||||||
|
|
||||||
typedef Splice<List1, NullType, 1> Overl12;
|
using Overl12 = Splice<List1, Nil, 1>;
|
||||||
DISPLAY (Overl12);
|
DISPLAY (Overl12);
|
||||||
|
|
||||||
typedef Splice<List1, NullType, 5> Overl13;
|
using Overl13 = Splice<List1, Nil, 5>;
|
||||||
DISPLAY (Overl13);
|
DISPLAY (Overl13);
|
||||||
|
|
||||||
|
|
||||||
typedef TyOLD<Num<99>>::List OLi2;
|
using OLi2 = TyOLD<Num<99>>::List;
|
||||||
typedef Splice<List1, OLi2, 0>::Front Front1;
|
using Front1 = Splice<List1, OLi2, 0>::Front;
|
||||||
typedef Splice<List1, OLi2, 1>::Front Front2;
|
using Front2 = Splice<List1, OLi2, 1>::Front;
|
||||||
typedef Splice<List1, OLi2, 5>::Front Front3;
|
using Front3 = Splice<List1, OLi2, 5>::Front;
|
||||||
DISPLAY (Front1);
|
DISPLAY (Front1);
|
||||||
DISPLAY (Front2);
|
DISPLAY (Front2);
|
||||||
DISPLAY (Front3);
|
DISPLAY (Front3);
|
||||||
typedef Splice<List1, OLi2, 0>::Back Back1;
|
using Back1 = Splice<List1, OLi2, 0>::Back;
|
||||||
typedef Splice<List1, OLi2, 1>::Back Back2;
|
using Back2 = Splice<List1, OLi2, 1>::Back;
|
||||||
typedef Splice<List1, OLi2, 5>::Back Back3;
|
using Back3 = Splice<List1, OLi2, 5>::Back;
|
||||||
DISPLAY (Back1);
|
DISPLAY (Back1);
|
||||||
DISPLAY (Back2);
|
DISPLAY (Back2);
|
||||||
DISPLAY (Back3);
|
DISPLAY (Back3);
|
||||||
|
|
||||||
// Note: with a Null-Overlay, this can be used to extract arbitrary sublists:
|
// Note: with a Null-Overlay, this can be used to extract arbitrary sublists:
|
||||||
typedef Splice<List1, NullType, 1>::Front Front4;
|
using Front4 = Splice<List1, Nil, 1>::Front;
|
||||||
typedef Splice<List1, NullType, 1>::Back Back4;
|
using Back4 = Splice<List1, Nil, 1>::Back;
|
||||||
DISPLAY (Front4);
|
DISPLAY (Front4);
|
||||||
DISPLAY (Back4);
|
DISPLAY (Back4);
|
||||||
}
|
}
|
||||||
|
|
@ -241,25 +241,25 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_s_last()
|
check_s_last()
|
||||||
{
|
{
|
||||||
typedef SplitLast<List1>::Type Elm;
|
using Elm = SplitLast<List1>::Type;
|
||||||
typedef SplitLast<List1>::List Prefix;
|
using Prefix = SplitLast<List1>::List;
|
||||||
|
|
||||||
typedef TyOLD<Elm>::List ElmL;
|
using ElmL = TyOLD<Elm>::List;
|
||||||
|
|
||||||
DISPLAY (Prefix);
|
DISPLAY (Prefix);
|
||||||
DISPLAY (ElmL);
|
DISPLAY (ElmL);
|
||||||
|
|
||||||
typedef SplitLast<ElmL>::Type Elm1;
|
using Elm1 = SplitLast<ElmL>::Type;
|
||||||
typedef SplitLast<ElmL>::List NPrefix;
|
using NPrefix = SplitLast<ElmL>::List;
|
||||||
|
|
||||||
DISPLAY (NPrefix);
|
DISPLAY (NPrefix);
|
||||||
DISPLAY (TyOLD<Elm1>);
|
DISPLAY (TyOLD<Elm1>);
|
||||||
|
|
||||||
typedef SplitLast<NullType>::Type Nil;
|
using NilSplit = SplitLast<Nil>::Type;
|
||||||
typedef SplitLast<NullType>::List NList;
|
using NList = SplitLast<Nil>::List;
|
||||||
|
|
||||||
DISPLAY (NList);
|
DISPLAY (NList);
|
||||||
DISPLAY (TyOLD<Nil>);
|
DISPLAY (TyOLD<NilSplit>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -269,16 +269,16 @@ namespace test {
|
||||||
typedef Append<List1,List2>::List LL;
|
typedef Append<List1,List2>::List LL;
|
||||||
DISPLAY (LL);
|
DISPLAY (LL);
|
||||||
|
|
||||||
typedef Dissect<LL>::List List; DISPLAY(List);
|
using List = Dissect<LL>::List; DISPLAY(List);
|
||||||
typedef Dissect<LL>::First First; DISPLAY(First);
|
using First = Dissect<LL>::First; DISPLAY(First);
|
||||||
typedef Dissect<LL>::Tail Tail; DISPLAY(Tail);
|
using Tail = Dissect<LL>::Tail; DISPLAY(Tail);
|
||||||
typedef Dissect<LL>::Prefix Prefix; DISPLAY(Prefix);
|
using Prefix = Dissect<LL>::Prefix; DISPLAY(Prefix);
|
||||||
typedef Dissect<LL>::Last Last; DISPLAY(Last);
|
using Last = Dissect<LL>::Last; DISPLAY(Last);
|
||||||
|
|
||||||
typedef Dissect<LL>::Head Head;
|
using Head = Dissect<LL>::Head;
|
||||||
typedef Dissect<LL>::End End;
|
using End = Dissect<LL>::End;
|
||||||
|
|
||||||
typedef TyOLD<Head,End> HeadEnd; DISPLAY(HeadEnd);
|
using HeadEnd = TyOLD<Head,End>; DISPLAY(HeadEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -290,7 +290,7 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_apply ()
|
check_apply ()
|
||||||
{
|
{
|
||||||
typedef Apply<List1, AddConst2> Added2;
|
using Added2 = Apply<List1, AddConst2>;
|
||||||
DISPLAY (Added2);
|
DISPLAY (Added2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -301,7 +301,7 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_filter ()
|
check_filter ()
|
||||||
{
|
{
|
||||||
typedef Filter<Append<List1,List2>::List, IsEven > FilterEven;
|
using FilterEven = Filter<Append<List1,List2>::List, IsEven >;
|
||||||
DISPLAY (FilterEven);
|
DISPLAY (FilterEven);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,23 +309,23 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_prefix ()
|
check_prefix ()
|
||||||
{
|
{
|
||||||
typedef PrefixAll<Num<11>,Num<22>> Prefix1;
|
using Prefix1 = PrefixAll<Num<11>,Num<22>>;
|
||||||
DISPLAY (Prefix1);
|
DISPLAY (Prefix1);
|
||||||
|
|
||||||
typedef PrefixAll<Num<101>,List1> Prefix2;
|
using Prefix2 = PrefixAll<Num<101>,List1>;
|
||||||
DISPLAY (Prefix2);
|
DISPLAY (Prefix2);
|
||||||
|
|
||||||
typedef PrefixAll<NullType,List1> Prefix3;
|
using Prefix3 = PrefixAll<Nil,List1>;
|
||||||
DISPLAY (Prefix3);
|
DISPLAY (Prefix3);
|
||||||
|
|
||||||
typedef TyOLD<List1::List,Num<0>,List2::List>::List List_of_Lists;
|
using List_of_Lists = TyOLD<List1::List,Num<0>,List2::List>::List;
|
||||||
typedef PrefixAll<Num<111>,List_of_Lists> Prefix4;
|
using Prefix4 = PrefixAll<Num<111>, List_of_Lists>;
|
||||||
DISPLAY (Prefix4);
|
DISPLAY (Prefix4);
|
||||||
|
|
||||||
typedef PrefixAll<List1,List2> Prefix5;
|
using Prefix5 = PrefixAll<List1,List2>;
|
||||||
DISPLAY (Prefix5);
|
DISPLAY (Prefix5);
|
||||||
|
|
||||||
typedef PrefixAll<List1,List_of_Lists> Prefix6;
|
using Prefix6 = PrefixAll<List1,List_of_Lists>;
|
||||||
DISPLAY (Prefix6);
|
DISPLAY (Prefix6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -333,17 +333,17 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_distribute()
|
check_distribute()
|
||||||
{
|
{
|
||||||
typedef Distribute<Num<11>, List1> Dist1;
|
using Dist1 = Distribute<Num<11>, List1>;
|
||||||
DISPLAY (Dist1);
|
DISPLAY (Dist1);
|
||||||
|
|
||||||
typedef TyOLD<Num<11>,Num<22>,Num<33>>::List Prefixes;
|
using Prefixes = TyOLD<Num<11>,Num<22>,Num<33>>::List;
|
||||||
typedef Distribute<Prefixes, Num<0>> Dist2;
|
using Dist2 = Distribute<Prefixes, Num<0>>;
|
||||||
DISPLAY (Dist2);
|
DISPLAY (Dist2);
|
||||||
|
|
||||||
typedef Distribute<Prefixes, List1> Dist3;
|
using Dist3 = Distribute<Prefixes, List1>;
|
||||||
DISPLAY (Dist3);
|
DISPLAY (Dist3);
|
||||||
|
|
||||||
typedef Distribute<Prefixes, TyOLD<List1::List,List2::List>::List> Dist4;
|
using Dist4 = Distribute<Prefixes, TyOLD<List1::List,List2::List>::List>;
|
||||||
DISPLAY (Dist4);
|
DISPLAY (Dist4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,17 +351,16 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_combine()
|
check_combine()
|
||||||
{
|
{
|
||||||
typedef CountDown<Num<11>> Down;
|
using Down = CountDown<Num<11>>;
|
||||||
DISPLAY (Down);
|
DISPLAY (Down);
|
||||||
|
|
||||||
typedef Combine<List1::List, CountDown> Combi;
|
using Combi = Combine<List1::List, CountDown>;
|
||||||
DISPLAY (Combi);
|
DISPLAY (Combi);
|
||||||
|
|
||||||
typedef CombineFlags<List1::List> OnOff;
|
using OnOff = CombineFlags<List1::List>;
|
||||||
DISPLAY (OnOff);
|
DISPLAY (OnOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,15 +96,15 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_buildSeq ()
|
check_buildSeq ()
|
||||||
{
|
{
|
||||||
typedef Append<Types1::List, Types2::List>::List LL;
|
using LL = Append<Types1::List, Types2::List>::List;
|
||||||
DISPLAY (LL);
|
DISPLAY (LL);
|
||||||
|
|
||||||
typedef TyOLD<LL>::Seq Seq;
|
using Seq = TyOLD<LL>::Seq;
|
||||||
typedef Seq::List SeqList;
|
using SeqList = Seq::List;
|
||||||
DISPLAY (Seq);
|
DISPLAY (Seq);
|
||||||
DISPLAY (SeqList);
|
DISPLAY (SeqList);
|
||||||
|
|
||||||
typedef TyOLD<NodeNull>::Seq NulS;
|
using NulS = TyOLD<NilNode>::Seq;
|
||||||
DISPLAY (NulS);
|
DISPLAY (NulS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,16 +112,16 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_prepend ()
|
check_prepend ()
|
||||||
{
|
{
|
||||||
typedef Prepend<Num<5>, Types1> Prepend1;
|
using Prepend1 = Prepend<Num<5>, Types1 >;
|
||||||
DISPLAY(Prepend1);
|
DISPLAY(Prepend1);
|
||||||
|
|
||||||
typedef Prepend<NullType, Types1> Prepend2;
|
using Prepend2 = Prepend<Nil, Types1 >;
|
||||||
DISPLAY(Prepend2);
|
DISPLAY(Prepend2);
|
||||||
|
|
||||||
typedef Prepend<Num<5>, TyOLD<> > Prepend3;
|
using Prepend3 = Prepend<Num<5>, TyOLD<>>;
|
||||||
DISPLAY(Prepend3);
|
DISPLAY(Prepend3);
|
||||||
|
|
||||||
typedef Prepend<NullType, TyOLD<> > Prepend4;
|
using Prepend4 = Prepend<Nil, TyOLD<>>;
|
||||||
DISPLAY(Prepend4);
|
DISPLAY(Prepend4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,44 +129,44 @@ namespace test {
|
||||||
void
|
void
|
||||||
check_shift ()
|
check_shift ()
|
||||||
{
|
{
|
||||||
typedef Append<Types2::List, Types1::List>::List LL;
|
using LL = Append<Types2::List, Types1::List>::List;
|
||||||
typedef TyOLD<LL>::Seq Seq;
|
using Seq = TyOLD<LL>::Seq;
|
||||||
|
|
||||||
typedef Shifted<Seq,0>::Type Seq_0; DISPLAY (Seq_0);
|
using Seq_0 = Shifted<Seq,0>::Type; DISPLAY (Seq_0);
|
||||||
typedef Shifted<Seq,1>::Type Seq_1; DISPLAY (Seq_1);
|
using Seq_1 = Shifted<Seq,1>::Type; DISPLAY (Seq_1);
|
||||||
typedef Shifted<Seq,2>::Type Seq_2; DISPLAY (Seq_2);
|
using Seq_2 = Shifted<Seq,2>::Type; DISPLAY (Seq_2);
|
||||||
typedef Shifted<Seq,3>::Type Seq_3; DISPLAY (Seq_3);
|
using Seq_3 = Shifted<Seq,3>::Type; DISPLAY (Seq_3);
|
||||||
typedef Shifted<Seq,4>::Type Seq_4; DISPLAY (Seq_4);
|
using Seq_4 = Shifted<Seq,4>::Type; DISPLAY (Seq_4);
|
||||||
typedef Shifted<Seq,5>::Type Seq_5; DISPLAY (Seq_5);
|
using Seq_5 = Shifted<Seq,5>::Type; DISPLAY (Seq_5);
|
||||||
typedef Shifted<Seq,6>::Type Seq_6; DISPLAY (Seq_6);
|
using Seq_6 = Shifted<Seq,6>::Type; DISPLAY (Seq_6);
|
||||||
|
|
||||||
typedef TyOLD<Shifted<Seq,0>::Head> Head_0; DISPLAY (Head_0);
|
using Head_0 = TyOLD<Shifted<Seq,0>::Head>; DISPLAY (Head_0);
|
||||||
typedef TyOLD<Shifted<Seq,1>::Head> Head_1; DISPLAY (Head_1);
|
using Head_1 = TyOLD<Shifted<Seq,1>::Head>; DISPLAY (Head_1);
|
||||||
typedef TyOLD<Shifted<Seq,2>::Head> Head_2; DISPLAY (Head_2);
|
using Head_2 = TyOLD<Shifted<Seq,2>::Head>; DISPLAY (Head_2);
|
||||||
typedef TyOLD<Shifted<Seq,3>::Head> Head_3; DISPLAY (Head_3);
|
using Head_3 = TyOLD<Shifted<Seq,3>::Head>; DISPLAY (Head_3);
|
||||||
typedef TyOLD<Shifted<Seq,4>::Head> Head_4; DISPLAY (Head_4);
|
using Head_4 = TyOLD<Shifted<Seq,4>::Head>; DISPLAY (Head_4);
|
||||||
typedef TyOLD<Shifted<Seq,5>::Head> Head_5; DISPLAY (Head_5);
|
using Head_5 = TyOLD<Shifted<Seq,5>::Head>; DISPLAY (Head_5);
|
||||||
typedef TyOLD<Shifted<Seq,6>::Head> Head_6; DISPLAY (Head_6);
|
using Head_6 = TyOLD<Shifted<Seq,6>::Head>; DISPLAY (Head_6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
check_split ()
|
check_split ()
|
||||||
{
|
{
|
||||||
typedef Append<Types1::List, Types2::List>::List LL;
|
using LL = Append<Types1::List, Types2::List>::List;
|
||||||
typedef TyOLD<LL>::Seq Seq;
|
using Seq = TyOLD<LL>::Seq;
|
||||||
DISPLAY (Seq);
|
DISPLAY (Seq);
|
||||||
|
|
||||||
typedef Split<Seq>::List List; DISPLAY(List);
|
using List = Split<Seq>::List; DISPLAY(List);
|
||||||
typedef Split<Seq>::First First; DISPLAY(First);
|
using First = Split<Seq>::First; DISPLAY(First);
|
||||||
typedef Split<Seq>::Tail Tail; DISPLAY(Tail);
|
using Tail = Split<Seq>::Tail; DISPLAY(Tail);
|
||||||
typedef Split<Seq>::Prefix Prefix; DISPLAY(Prefix);
|
using Prefix = Split<Seq>::Prefix; DISPLAY(Prefix);
|
||||||
typedef Split<Seq>::Last Last; DISPLAY(Last);
|
using Last = Split<Seq>::Last; DISPLAY(Last);
|
||||||
|
|
||||||
typedef Split<Seq>::Head Head;
|
using Head = Split<Seq>::Head;
|
||||||
typedef Split<Seq>::End End;
|
using End = Split<Seq>::End;
|
||||||
|
|
||||||
typedef TyOLD<Head,End> HeadEnd; DISPLAY(HeadEnd);
|
using HeadEnd = TyOLD<Head,End>; DISPLAY(HeadEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -727,13 +727,13 @@ namespace test {
|
||||||
auto quoted = accept_repeated(accept(nonQuot).alt(escape));
|
auto quoted = accept_repeated(accept(nonQuot).alt(escape));
|
||||||
auto quote = accept_bracket("\"\"", quoted);
|
auto quote = accept_bracket("\"\"", quoted);
|
||||||
|
|
||||||
auto paren = expectResult<NullType>();
|
auto paren = expectResult<Nil>();
|
||||||
auto nonParen = accept(R"_([^\\\(\)"]+)_");
|
auto nonParen = accept(R"_([^\\\(\)"]+)_");
|
||||||
auto parenCont = accept_repeated(accept(nonParen)
|
auto parenCont = accept_repeated(accept(nonParen)
|
||||||
.alt(escape)
|
.alt(escape)
|
||||||
.alt(quote)
|
.alt(quote)
|
||||||
.alt(paren));
|
.alt(paren));
|
||||||
paren = accept_bracket("()", parenCont).bind([](auto){ return NullType{}; });
|
paren = accept_bracket("()", parenCont).bind([](auto){ return Nil{}; });
|
||||||
|
|
||||||
auto spec = accept_repeated(accept(content)
|
auto spec = accept_repeated(accept(content)
|
||||||
.alt(escape)
|
.alt(escape)
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ namespace test {
|
||||||
{
|
{
|
||||||
using Ret = typename lib::meta::_Fun<SIG>::Ret;
|
using Ret = typename lib::meta::_Fun<SIG>::Ret;
|
||||||
using Args = typename lib::meta::_Fun<SIG>::Args;
|
using Args = typename lib::meta::_Fun<SIG>::Args;
|
||||||
using ArgsX = typename lib::meta::StripNullType<Args>::Seq; ////////////////////////////////////TICKET #987 : make lib::meta::Types<TYPES...> variadic
|
using ArgsX = typename lib::meta::StripNil<Args>::Seq; ////////////////////////////////////TICKET #987 : make lib::meta::Types<TYPES...> variadic
|
||||||
using SigTypes = typename lib::meta::Prepend<Ret, ArgsX>::Seq;
|
using SigTypes = typename lib::meta::Prepend<Ret, ArgsX>::Seq;
|
||||||
|
|
||||||
using Type = typename RebindVariadic<DiagnosticFun, SigTypes>::Type;
|
using Type = typename RebindVariadic<DiagnosticFun, SigTypes>::Type;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue