mpl.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_mpl_
18 #define HH_SENF_Utils_mpl_ 1
19 
20 // Custom includes
21 #include <senf/config.hh>
22 
23 //#include "mpl.mpp"
24 #include "mpl.ih"
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 namespace mpl {
29 
41  struct nil {};
42 
106  template <unsigned n>
107  struct rv {
108  char _[SENF_MPL_RV_ALIGNMENT][n+1];
109  };
110 
119 # define SENF_MPL_RV(expr) (sizeof(expr)/SENF_MPL_RV_ALIGNMENT-1)
120 
129  template <unsigned long _> struct take_uint {};
130 
139  template <long _> struct take_int {};
140 
148  template <class _> struct take_class {};
149 
150 #ifndef SENF_MPL_SLOT_NOEXPAND
151 
183 # define SENF_MPL_SLOT_DEF(name,value) \
184  template <class _> \
185  static senf::mpl::rv<0> _SENF_MPL_SLOT_ ## name (_); \
186  SENF_MPL_SLOT_SET(name,value)
187 
195 # define SENF_MPL_SLOT_DEF_ZERO(name) \
196  template <class _> \
197  static senf::mpl::rv<0> _SENF_MPL_SLOT_ ## name (_);
198 
204 # define SENF_MPL_SLOT_SET(name,value) \
205  static senf::mpl::rv<unsigned(value)+1> \
206  _SENF_MPL_SLOT_ ## name (senf::mpl::take_int<__LINE__>)
207 
213 # define SENF_MPL_SLOT_GET(name) \
214  SENF_MPL_SLOT_I_GET(name)
215 
216 #endif
217 
218 }}
219 
220 //-/////////////////////////////////////////////////////////////////////////////////////////////////
221 //#include "mpl.cci"
222 //#include "mpl.ct"
223 //#include "mpl.cti"
224 #endif
225 
226 
227 // Local Variables:
228 // mode: c++
229 // fill-column: 100
230 // comment-column: 40
231 // c-file-style: "senf"
232 // indent-tabs-mode: nil
233 // ispell-local-dictionary: "american"
234 // compile-command: "scons -u test"
235 // End:
Take an arbitrary type template argument.
Definition: mpl.hh:148
Take an arbitrary integer template argument.
Definition: mpl.hh:139
Marker class for empty default values etc.
Definition: mpl.hh:41
Take an arbitrary unsigned integer template argument.
Definition: mpl.hh:129
Return-value type used to implement overload selection.
Definition: mpl.hh:107