I need to be able to expand a macro to build a typedef which I use for my application. The macro builds a simple typedef. The question I have is how do __VA_ARGS__
(i.e. do you lose arguments farther down the calls?) act when passed through to numerous macros and how to know when another scan is required to force proper results as I think this might be the source of the problem when creating higher order DERIVED
macros.
#define DERIVED0() rtti::impl::BaseTypedefList<rtti::impl::null>
#define DERIVED1(T1) rtti::impl::BaseTypedefList<T1, DERIVED0()>
#define DERIVED2(T1, T2) rtti::impl::BaseTypedefList<T1, DERIVED1(T2)>
#define BUILD(count, ...) DERIVED##count( __VA_ARGS__ )
// inside the classes
#define CLASS_BODY(count, ...) typedef BUILD(count, __VA_ARGS__) BaseClassList;
// example usages
CLASS_BODY(0) // WORKS
CLASS_BODY(1, MeshRenderer) // WORKS
CLASS_BODY(2, Renderer, Object) // ERROR