Boost logo

Boost Users :

Subject: [Boost-users] [preprocessor] one comma too many
From: Manfred Doudar (manfred.doudar_at_[hidden])
Date: 2010-05-26 07:08:13


Hello,

Near sure this is trivial, but I don't see it, and hope someone might
point out the obvious:

#include <boost/preprocessor/iteration/local.hpp>
#include <boost/preprocessor/repetition.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>

#define OPERATOR(z, n, _) \
                                     \
  BOOST_PP_ENUM_PARAMS(n, T r)
  /**/

#define BOOST_PP_LOCAL_MACRO(n) OPERATOR(_, n, _)
#define BOOST_PP_LOCAL_LIMITS(1, 3)
#include BOOST_PP_LOCAL_ITERATE()
#undef BOOST_PP_LOCAL_MACRO
#undef BOOST_PP_LOCAL_LIMITS
#undef OPERATOR

..The above works as expected:

   T r0
   T r0, T r1
   T r0, T r1, T r2

However, I would like to replace "T" with the following instead:

  std::pair<T, T>

ie: I want to write something to the effect of:

  BOOST_PP_ENUM_PARAMS(n, std::pair<T, T> r)

Of course, BOOST_PP_ENUM_PARAMS now sees one too many arguments, and
errors. Any ideas on how to achieve this would be most appreciated.

With thanks in advance,

-- 
Manfred

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net