Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
variadic-rebind.hpp
Go to the documentation of this file.
1/*
2 VARIADIC-REBIND.hpp - metaprogramming utilities for parameter- and type sequences
3
4 Copyright (C)
5 2023, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
53#ifndef LIB_META_VARIADIC_REBIND_H
54#define LIB_META_VARIADIC_REBIND_H
55
56
57namespace lib {
58namespace meta {
59
60
61
62
63 /* ==== Rebinding Variadic Arguments ==== **/
64
72 template<template<typename...> class X, typename...ARGS>
74 {
75 using Type = X<ARGS...>;
76 };
77
78 template<template<typename...> class X
79 ,template<typename...> class U
80 ,typename...ARGS>
81 struct RebindVariadic<X, U<ARGS...>>
82 {
83 using Type = X<ARGS...>;
84 };
85
86
87
88
89
90 /* ==== Rebuild with remoulded variadic sequence ==== **/
91
108 template<template<class...> class L, typename...XS>
109 struct _Vari;
110
111 template<template<class...> class L, typename X, typename...XS>
112 struct _Vari<L, X, L<XS...>>
113 {
114 using Prepend = L<X,XS...>;
115 using Append = L<XS...,X>;
116 };
117
118 template<template<class...> class L, typename X1, typename X2>
119 struct _Vari<L, X1,X2>
120 {
121 using Penult = X1;
122 using Ultima = X2;
123 using Prefix = L<X1>;
124 using Remain = L<X2>;
126 };
127
128 template<template<class...> class L, typename X>
129 struct _Vari<L, X>
130 {
131 using Ultima = X;
132 using Penult = Nil;
133 using Remain = L<X>;
134 using Revers = L<X>;
135 using Prefix = L<>;
136 };
137
138 template<template<class...> class L, typename X, typename...XS>
139 struct _Vari<L, X,XS...>
140 {
141 using Penult = _Vari<L,XS...>::Penult;
142 using Ultima = _Vari<L,XS...>::Ultima;
143
145 using _Tail_Rev_ = _Vari<L,XS...>::Revers;
146
147 using Remain = L<XS...>;
150 };
151
152}} // namespace lib::meta
153#endif /*LIB_META_VARIADIC_REBIND_H*/
_Vari< L, XS... >::Penult Penult
_Vari< L, XS... >::Revers _Tail_Rev_
Splice< LI, Nil, l >::Front Prefix
extract prefix of given length
_Vari< L, XS... >::Ultima Ultima
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
_Vari< L, Ultima, _Tail_Rev_ >::Prepend Revers
_Vari< L, X, _Tail_Pre_ >::Prepend Prefix
_Vari< L, XS... >::Prefix _Tail_Pre_
»Empty« mark
Definition typelist.hpp:82
Metaprogramming helper to transfer variadic arguments.
Metaprogramming helper to remould the type sequence in the template arguments of a variadic template.
Implementation namespace for support and library code.