|
Boost Users : |
From: Chris Weed (chrisweed_at_[hidden])
Date: 2006-06-14 22:27:45
Actually, I did get a hacked up version of your code to do this, but
it certainly isn't elegant.
Here it is:
#include <boost/preprocessor/seq/cat.hpp>
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/preprocessor/seq/for_each_product.hpp>
#include <boost/preprocessor/seq/transform.hpp>
#define A(r, product) \
typedef MyClass< \
BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_TRANSFORM(B, 1, product)) \
> \
BOOST_PP_SEQ_CAT((My_) BOOST_PP_SEQ_TRANSFORM(B, 0, product)); \
/**/
#define B(s, i, elem) BOOST_PP_SEQ_ELEM(i, elem)
#define TYPE(alpha, id) ((alpha)(id))
BOOST_PP_SEQ_FOR_EACH_PRODUCT(
A,
( TYPE(c, char) TYPE(i, int) TYPE(f, float) )
( TYPE(c, MyClassB<char) TYPE(b, MyClassB<bool))
( TYPE(c, char>) TYPE(i, int>) TYPE(f, float>) TYPE(d, double>) )
( TYPE(c, char) TYPE(i, int) TYPE(f, float) TYPE(d, double) )
)
#undef A
#undef B
#undef TYPE
Thanks again,
Chris
On 6/14/06, Chris Weed <chrisweed_at_[hidden]> wrote:
> Sorry for my poor explanation.
> What I was trying to do was permute the types that weren't MyClassA and MyClassB
>
> Such as:
> typedef MyClassA<float,MyClassB<bool,char>,int> My_fbci;
> typedef MyClassA<float,MyClassB<bool,char>,float> My_fbcf;
> typedef MyClassA<char,MyClassB<float,float>,float> My_cfff;
> typedef MyClassA<float,MyClassB<int,float>,float> My_fiff;
> ...
>
> Thanks for your help,
> Chris
>
>
> On 6/14/06, Paul Mensonides <pmenso57_at_[hidden]> wrote:
> > > -----Original Message-----
> > > From: boost-users-bounces_at_[hidden]
> > > [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Chris Weed
> >
> > > Thanks,
> > > That is exactly what I need.
> > > I don't want to take up too much more of your time, but how
> > > would I add template arguments for template template parameters like:
> > >
> > > typedef MyClassA<float,MyClassB<bool,char>,int> Myfbci;
> > >
> > > MyClassA and MyClassB don't need to change.
> >
> > I'm not sure what you mean. Do you mean passing 'MyClassB<bool, char>' as one
> > of the elements of the permutated sequences, or do you mean that 'bool' and
> > 'char' are elements of the permutated sequences?
> >
> > (On my way out the door, and I won't be able to reply for about ten hours.)
> >
> > Regards,
> > Paul Mensonides
> >
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
>
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