Quote:Just give'em a header from one of boost libraries that generates code from a mix of macro & template metaprogramming and they lay a brick in their paints....
snipped for brevity
#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value#define BOOST_ASSIGN_MAX_PARAMS 5#endif #define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1) #define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class U)#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, U, const& u)#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, u)#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)#define BOOST_PP_LOCAL_MACRO(n) template< class U, BOOST_ASSIGN_PARAMS1(n) > generic_ptr_list& operator()(U const& u, BOOST_ASSIGN_PARAMS2(n) ) { this->push_back( new T(u, BOOST_ASSIGN_PARAMS3(n))); return *this; } /**/ #include BOOST_PP_LOCAL_ITERATE() }; // class 'generic_ptr_list'} // namespace 'assign_detail'namespace assign{ template< class T > inline assign_detail::generic_ptr_list<T> ptr_list_of() { return assign_detail::generic_ptr_list<T>()(); } template< class T, class U > inline assign_detail::generic_ptr_list<T> ptr_list_of( const U& t ) { return assign_detail::generic_ptr_list<T>()( t ); }#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)#define BOOST_PP_LOCAL_MACRO(n) template< class T, class U, BOOST_ASSIGN_PARAMS1(n) > inline assign_detail::generic_ptr_list<T> ptr_list_of(U const& u, BOOST_ASSIGN_PARAMS2(n) ) { return assign_detail::generic_ptr_list<T>()(u, BOOST_ASSIGN_PARAMS3(n)); } /**/ #include BOOST_PP_LOCAL_ITERATE()