Listing 4
#define T(name, fields)\ class name { \ private: \ const unsigned char* data; \ BOOST_PP_SEQ_FOR_EACH_I(DEFINE_CACHED_VALUES, fields, fields) \ public: \ /* Constructor */ \ name(const unsigned char* _data) : data(_data) \ BOOST_PP_SEQ_FOR_EACH_I(INITIALIZE_CACHED_VALUES, fields, fields) \ {}; \ /* xxx() methods */ \ BOOST_PP_SEQ_FOR_EACH_I(DEFINE_ACCESSORS, fields, fields) \ size_t num_bits(void) const { \ return 0 BOOST_PP_SEQ_FOR_EACH(PLUS_NUM_BITS, ~, fields); \ }; \ };