The BOOST_PP_ENUM_BINARY_PARAMS_Z macro generates a comma-separated list of binary parameters.  It reenters BOOST_PP_REPEAT with maximum efficiency.

Usage

BOOST_PP_ENUM_BINARY_PARAMS_Z(z, count, p1, p2)

Arguments

z
The next available BOOST_PP_REPEAT dimension.
count
The number of parameters to generate.  Valid values range from 0 to BOOST_PP_LIMIT_REPEAT.
p1
The text of the first part of the parameter.  BOOST_PP_ENUM_BINARY_PARAMS concatenates numbers ranging from 0 to count - 1 to generate parameters.
p2
The text of the first part of the parameter.  BOOST_PP_ENUM_BINARY_PARAMS concatenates numbers ranging from 0 to count - 1 to generate parameters.

Remarks

This macro expands to the comma-separated sequence:
p1 ## 0 p2 ## 0, p1 ## 1 p2 ## 1, ... p1 ## count - 1 p2 ## count - 1
This macro is a replacement for both BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT and BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS.

See Also

Requirements

Header:  <boost/preprocessor/repetition/enum_binary_params.hpp>

Sample Code

#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>

#define FUNCTION(z, n, _) \
   template<BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(n), class T)> \
   void f(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, BOOST_PP_INC(n), T, p)) { \
      /* ... */ \
   } \
   /**/

BOOST_PP_REPEAT(2, FUNCTION, nil)
/*
   expands to...

   template<class T0> void f(T0 p0) { }
   template<class T0, class T1> void f(T0 p0, T1 p1) { }
*/

© Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)