Beispiel #1
0
    namespace v1
    {
      template <
        BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
          MPLLIBS_LIMIT_COMPOSE_SIZE,
          class F,
          boost::mpl::na
        )
      >
      struct compose;
      
      template <>
      struct compose<
        BOOST_PP_ENUM(
          MPLLIBS_LIMIT_COMPOSE_SIZE,
          boost::mpl::na BOOST_PP_TUPLE_EAT(3),
          ~
        )
      >
      {
        typedef compose type;

        template <class T>
        struct apply
        {
          typedef T type;
        };
      };
      
      #ifdef MPLLIBS_COMPOSE_CASE
      #  error MPLLIBS_COMPOSE_CASE already defined
Beispiel #2
0
#include <boost/preprocessor/punctuation/paren.hpp>
#include <boost/preprocessor/tuple/eat.hpp>

#define _MAX_ARGS 64

/* Python code for generating The TF_ARG_N() macros:
for i in range(1, 32+1):
    line = '#define TF_ARG_%d(' % i
    for j in range(1, i):
        line += '_%d,' % j
    line += '_%d,...) _%d' % (i, i)
    print(line)
*/

// Make sure TF_ARG_N() supports at least BOOST_PP_LIMIT_TUPLE arguments.

#define _TF_ARG_ERROR(a, b, c)
#define _TF_ARG_TUPLE_OVERFLOW(a, b, c)

BOOST_PP_IIF(BOOST_PP_EQUAL(1,                                          \
    BOOST_PP_EXPAND(BOOST_PP_CAT(TF_ARG_, _MAX_ARGS) BOOST_PP_LPAREN()  \
    _TF                                                                 \
    BOOST_PP_REPEAT(BOOST_PP_SUB(_MAX_ARGS, 2), _TF_NUM_ARGS_REP, _TF)  \
    BOOST_PP_COMMA() 1 BOOST_PP_RPAREN())),                             \
    BOOST_PP_TUPLE_EAT(1), _TF_ARG_ERROR)(...)

BOOST_PP_IIF(BOOST_PP_GREATER_EQUAL(_MAX_ARGS, BOOST_PP_LIMIT_TUPLE), \
             BOOST_PP_TUPLE_EAT(1), _TF_ARG_TUPLE_OVERFLOW)(...)
 
#endif