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
On 05/26/2010 01:08 PM, Manfred Doudar wrote:
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,
Hi, You must use a typedef to hide that comma : typedef std::pair<T, T> pairTT_t; BOOST_PP_ENUM_PARAM(n, pairTT_t r) -- Maxime
On Wed, 26 May 2010 13:24:45 +0200 Maxime van Noppen <maxime@altribe.org> wrote:
On 05/26/2010 01:08 PM, Manfred Doudar wrote:
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,
Hi,
You must use a typedef to hide that comma :
typedef std::pair<T, T> pairTT_t; BOOST_PP_ENUM_PARAM(n, pairTT_t r)
Thank you Maxime for pointing out the obvious, I should have known better. Cheers, -- Manfred
You can also use BOOST_PP_COMMA() to defer the comma... BOOST_PP_ENUM_PARAMS(n, std::pair<T BOOST_PP_COMMA() T> r)
Date: Wed, 26 May 2010 13:24:45 +0200 From: maxime@altribe.org To: boost-users@lists.boost.org Subject: Re: [Boost-users] [preprocessor] one comma too many
On 05/26/2010 01:08 PM, Manfred Doudar wrote:
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,
Hi,
You must use a typedef to hide that comma :
typedef std::pair<T, T> pairTT_t; BOOST_PP_ENUM_PARAM(n, pairTT_t r)
-- Maxime _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_________________________________________________________________ De Nieuwste Internet Explorer speciaal voor Hotmail, download nu gratis http://www.microsoft.com/netherlands/ie8/hotmail.htm
participants (3)
-
Daniel Bradburn
-
Manfred Doudar
-
Maxime van Noppen