#include #include #define SEQ \ ( ( double, prop1 ) ) \ ( ( float, prop2 ) ) \ ( () ) #define OSD_apply( r, macro, tuple ) macro tuple // this is just a BOOST_PP_SEQ_FOR_EACH that strips the (()) // placeholder at the end of sequences, so's to allow empty sequences: #define OSD_SEQ_FOR_EACH_BUT_LAST( macro, data, seq ) \ BOOST_PP_IF( BOOST_PP_GREATER( BOOST_PP_SEQ_SIZE( seq ), 1 ), \ BOOST_PP_SEQ_FOR_EACH( macro, data, BOOST_PP_SEQ_POP_BACK( seq ) ), ) #if TRY == 1 #define OSD_declare( Type, Name ) \ boost::enable_if_c Name() const; #endif #if TRY == 2 #define OSD_declare( Type, Name ) \ boost::enable_if_c Name() const; #endif #if TRY == 3 #define OSD_declare( Type, Name ) \ boost::enable_if_c Name() const; #endif #if TRY == 4 #define OSD_declare( Type, Name ) \ boost::enable_if_c Name() const; #endif #if TRY == 5 #define OSD_declare( Type, Name ) \ boost::enable_if_c Name() const; #endif #if TRY == 6 #define OSD_declare( Type, Name ) \ boost::enable_if_c Name() const; #endif class Foo { public: #if 1 <= TRY && TRY <= 6 OSD_SEQ_FOR_EACH_BUT_LAST( OSD_apply, OSD_declare, SEQ ) #endif #if TRY == 7 # define OSD_declare( r, data, item ) \ boost::enable_if_c BOOST_PP_TUPLE_ELEM( 2, 1, item )() const; OSD_SEQ_FOR_EACH_BUT_LAST( OSD_declare, ~, SEQ ) #endif };