On Tue, Feb 12, 2013 at 9:53 AM, Adam Badura <abadura@o2.pl> wrote:
I have following code:
 
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/preprocessor/seq/transform.hpp>
 
template< int I, int J >
struct Base
{
};

#define SEQ ( 1 ) ( 2 ) ( 3 ) ( 4 )
 
#define OP( s, data, elem ) Base< elem, elem > 

Try something like
  #define OP(s, data, elem) (Base< elem)(elem >)
and...

 
struct Derived
  : BOOST_PP_SEQ_ENUM( BOOST_PP_SEQ_TRANSFORM( OP, nil, SEQ ) )
{
};

...use something like BOOST_PP_SEQ_FOREACH instead of BOOST_PP_SEQ_TRANSFORM.
 
The Derived has bases classes generated from a sequence (SEQ). The bases classes themselves are instantiations of Base template type. I expected the code to be preprocessed into something like (just the important part):
 
struct Derived
  : Base< 1, 1 >, Base< 2, 2 >, Base< 3, 3 >, Base< 4, 4 >
{
};
but instead it is preprocessed into:
 
struct Derived
  : Base< 1, Base< 2, Base< 3, Base< 4
{
};
This obviously is caused by Base being template with to parameters and thus having a comma.
 
Adding parenthesis around Base in OP solves the issue by generating expected code fully. But it still does not compile because parenthesis are not allowed in that place (base classes list).
 
Is there any other workaround? How to deal with it?

Hopefully that puts you on the right track. If you need more detail, holler back.

- Jeff