Listing 4
#define BEGIN_REFLECTION(ClassName) \
public: \
operator CompileTIterableObjectTag()const; \
ClassName::ClassName() \
{ \
initReflectedMembers(*this); \
} \
struct Gap_Num{}; \
template<int No, int Dummy = 0> struct GetNameTag; \
template<int No, int Dummy = 0> struct GetValueType; \
template<class Tag, int Dummy = 0> \
struct GetValueTypeByTag; \
template<class Tag, int Dummy = 0> struct AttributePos; \
template<int Line, int Dummy = 0> struct AttributeNum \
{ \
typedef Gap_Num IsGap; \
typedef AttributeNum<Line - 1,Dummy> PrevOrGap; \
enum {PrevIsGap = ::boost::is_same< \
typename PrevOrGap::IsGap, \
Gap_Num>::value}; \
typedef typename boost::ct_if<(PrevIsGap != 0), \
typename PrevOrGap::PrevNoGap, \
PrevOrGap>::type PrevNoGap; \
enum { value = PrevNoGap::value + 1}; \
}; \
template<int Dummy> struct AttributeNum<0,Dummy> \
{ \
enum { value = -1}; \
typedef int IsGap; \
typedef AttributeNum<0,Dummy> PrevNoGap; \
}; \
enum {beginLineNo = __LINE__};