[preprocessor] add pointer to T..

Hello,
Thinking maybe little to late in the night at my end, but can see how
to generate the following:
T0*
T0*, T1*
T0*, T1*, T2*
..and so on
Some variant on the below maybe..? Of course, below, you'd get
T*0, T*1, etc if tried BOOST_PP_ENUM_PARAMS(n, T*)
which doesn't produce a valid token.
#include

On Sun, 30 May 2010 16:51:51 +0200
joel falcou
Manfred Doudar wrote:
Hello,
Thinking maybe little to late in the night at my end, but can see how to generate the following:
T0* T0*, T1* T0*, T1*, T2 #define MAKE_TYPE(z,n,t) BOOST_PP_CAT(T,n)*
BOOST_PP_ENUM(10,MAKE_TYPE,~)
Thank you Joel, but how do I get the repetition across the other dimension? - I'm thinking I need something like a For-loop in there, so I get the rows of varying lengths.. Cheers, -- Manfred

Manfred Doudar wrote:
Thank you Joel, but how do I get the repetition across the other dimension? - I'm thinking I need something like a For-loop in there, so I get the rows of varying lengths..
Try: #define MAKE_TYPE(z,n,t) BOOST_PP_CAT(T,n)* #define MAKE_ROW(z,n,t) BOOST_PP_ENUM(n,MAKE_TYPE,~) BOOST_PP_REPEAT(10,MAKE_ROW,~)

On Sun, 30 May 2010 17:14:47 +0200
joel falcou
joel falcou wrote:
#define MAKE_TYPE(z,n,t) BOOST_PP_CAT(T,n)* #define MAKE_ROW(z,n,t) BOOST_PP_ENUM(n,MAKE_TYPE,~)
BOOST_PP_REPEAT(10,MAKE_ROW,~)
I missed your need, you may just need to use BOOST_PP_FOR or BOOST_PP_ITERATE over your code calling the MAKE_TYPE in BOOST_PP_ENUM
Yes, ..trying that right now. However, if you or anyone else comes up with a solution, I'd be happy to see it. But I'll keep trying at this end. Thanks ever so much for your help to date. Cheers, -- Manfred

On Sun, 30 May 2010 17:14:47 +0200
joel falcou
joel falcou wrote:
#define MAKE_TYPE(z,n,t) BOOST_PP_CAT(T,n)* #define MAKE_ROW(z,n,t) BOOST_PP_ENUM(n,MAKE_TYPE,~)
BOOST_PP_REPEAT(10,MAKE_ROW,~)
I missed your need, you may just need to use BOOST_PP_FOR or BOOST_PP_ITERATE over your code calling the MAKE_TYPE in BOOST_PP_ENUM
Hello Joel, turns out you got what I wanted in your first post to me, ..just it's so late in the evening here (quarter to 2 in the morning), that I forgot to put back-slashes on my macros.. (need, more of coffee, and sleep.. well I should do one or the other, can't do one, while I do the other). Thank you again Joel for bearing with me while I sorted myself out. Cheers, -- Manfred

You can also achieve this by using BOOST_PP_ENUM_BINARY_PARAMS and BOOST_PP_INTERCEPT to remove the second concatenated index: BOOST_PP_ENUM_BINARY_PARAMS(3, T, * BOOST_PP_INTERCEPT) which expands to...T0* T0*, T1* T0*, T1*, T2*Which will save you having to use the extra define.
Date: Mon, 31 May 2010 01:41:20 +1000 From: manfred.doudar@rsise.anu.edu.au To: boost-users@lists.boost.org Subject: Re: [Boost-users] [preprocessor] add pointer to T..
On Sun, 30 May 2010 17:14:47 +0200 joel falcou
wrote: joel falcou wrote:
#define MAKE_TYPE(z,n,t) BOOST_PP_CAT(T,n)* #define MAKE_ROW(z,n,t) BOOST_PP_ENUM(n,MAKE_TYPE,~)
BOOST_PP_REPEAT(10,MAKE_ROW,~)
I missed your need, you may just need to use BOOST_PP_FOR or BOOST_PP_ITERATE over your code calling the MAKE_TYPE in BOOST_PP_ENUM
Hello Joel, turns out you got what I wanted in your first post to me, ..just it's so late in the evening here (quarter to 2 in the morning), that I forgot to put back-slashes on my macros.. (need, more of coffee, and sleep.. well I should do one or the other, can't do one, while I do the other).
Thank you again Joel for bearing with me while I sorted myself out.
Cheers, -- Manfred _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_________________________________________________________________ Download nu eenvoudig leuke Emoticons voor je Messenger GRATIS http://www.rulive.nl/aspx/emoticons.aspx

Thank you Daniel - your suggestion has also now just proved useful.
--Manfred
On Mon, 31 May 2010 00:19:53 +0000
Daniel Bradburn
You can also achieve this by using BOOST_PP_ENUM_BINARY_PARAMS and BOOST_PP_INTERCEPT to remove the second concatenated index: BOOST_PP_ENUM_BINARY_PARAMS(3, T, * BOOST_PP_INTERCEPT) which expands to...T0* T0*, T1* T0*, T1*, T2*Which will save you having to use the extra define.
Date: Mon, 31 May 2010 01:41:20 +1000 From: manfred.doudar@rsise.anu.edu.au To: boost-users@lists.boost.org Subject: Re: [Boost-users] [preprocessor] add pointer to T..
On Sun, 30 May 2010 17:14:47 +0200 joel falcou
wrote: joel falcou wrote:
#define MAKE_TYPE(z,n,t) BOOST_PP_CAT(T,n)* #define MAKE_ROW(z,n,t) BOOST_PP_ENUM(n,MAKE_TYPE,~)
BOOST_PP_REPEAT(10,MAKE_ROW,~)
I missed your need, you may just need to use BOOST_PP_FOR or BOOST_PP_ITERATE over your code calling the MAKE_TYPE in BOOST_PP_ENUM
Hello Joel, turns out you got what I wanted in your first post to me, ..just it's so late in the evening here (quarter to 2 in the morning), that I forgot to put back-slashes on my macros.. (need, more of coffee, and sleep.. well I should do one or the other, can't do one, while I do the other).
Thank you again Joel for bearing with me while I sorted myself out.
Cheers, -- Manfred _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_________________________________________________________________ Download nu eenvoudig leuke Emoticons voor je Messenger GRATIS http://www.rulive.nl/aspx/emoticons.aspx
participants (3)
-
Daniel Bradburn
-
joel falcou
-
Manfred Doudar