
I understand that Chaos won't implement workarounds. I was thinking more of forking chaos, and trying to implement it in msvc. Would that be a possibility? And with your knowledge of Chaos's implementation and msvc limitations, do you even think that it would even be remotely feasible?
I don't think it's feasible. You *might* be able to emulate the base interface over a completely separate (and much larger) implementation. However, you won't be able to emulate the extensibility model. For example, one of the defining things about Chaos is its ability to generalize recursion (not referring to the sequence tricks that I started this thread with).
Well, actually this code here will work in MSVC: #include <boost\preprocessor.hpp> #define PP_EMPTY(...) #define PP_EXPAND(...) __VA_ARGS__ #define PP_WHEN(x) BOOST_PP_IF(x, PP_EXPAND, PP_EMPTY) #define PP_DEFER(m) m PP_EMPTY() #define PP_OBSTRUCT(m) m PP_EMPTY PP_EMPTY()() #define EVAL(...) \ A(A(A(__VA_ARGS__))) \ /**/ #define A(...) B(B(B(__VA_ARGS__))) #define B(...) C(C(C(__VA_ARGS__))) #define C(...) D(D(D(__VA_ARGS__))) #define D(...) E(E(E(__VA_ARGS__))) #define E(...) F(F(F(__VA_ARGS__))) #define F(...) __VA_ARGS__ #define REPEAT(count, macro, ...) \ PP_WHEN(count)( \ REPEAT_INDIRECT PP_OBSTRUCT()()( \ BOOST_PP_DEC(count), macro, __VA_ARGS__ \ ) \ macro PP_OBSTRUCT()( \ BOOST_PP_DEC(count), __VA_ARGS__ \ ) \ ) \ /**/ #define REPEAT_INDIRECT() REPEAT #define PARAM(n, ...) BOOST_PP_COMMA_IF(n) __VA_ARGS__ ## n EVAL( REPEAT(100, PARAM, class T) ) // class T0, class T1, ... class T99 #define FIXED(n, ...) BOOST_PP_COMMA_IF(n) __VA_ARGS__ #define TTP(n, ...) \ BOOST_PP_COMMA_IF(n) \ template<REPEAT(BOOST_PP_INC(n), FIXED, class)> class __VA_ARGS__ ## n \ /**/ EVAL( REPEAT(3, TTP, T) ) // template<class> class T0, // template<class, class> class T1, // template<class, class, class> class T2 Of course, I had to add extra level of scans in the EVAL macro, otherwise it would stop at 62 repetitions. This will now handle up to 182 repetitions. Of course, a more efficient approach is done in Chaos, but perhaps the recursion backend could be implemented in MSVC, but it will be slower, which is ok since I don't develop on MSVC, I just need it to build on MSVC. I will look into this further. Thanks, Paul Fultz II