
On 11/08/2001 10:18 AM, Aleksey Gurtovoy wrote: [snip]
And the extensions themselves are here: http://groups.yahoo.com/group/boost/files/tuple_ext/
The test code in: libs/tuple_ext/test/tuple_iterator_test.cpp looks like the iterator, to be useful, requires some templated function similar to the: template<class Tuple> void foo(tuples::tuple_iterator<Tuple>) {} in that file. However, the template argument, Tuple, provides no clue to the programmer as to the argument type or which element in the tuple is being passed. Wouldn't a variant argument be more self-documenting? In addition, wouldn't some sort of visitor also be more self-documenting. The visitor would take the same argument as the tuple: visitor<tuple::type_list> BTW, the zip file did not have tuple.hpp; hence, I'm guessing what the appropriate nested type (type_list) for the tuple types would be. Then visitor could be defined as follows: template < typename HeadField , typename OtherFields
struct visited_fields < HeadField , OtherFields
: public OtherFields { virtual void visit_field( HeadField& a_field ) =0 ; }; struct empty_visited_field { protected: void visit_field ( void ) /**@brief * Only to avoid compile error during parse of subclass' * using declaration. */ ; }; }//exit visitors_detail namespace #include <boost/mpl/inherit_linearly.hpp> template < typename type_list
struct visitors : public boost::mpl::inherit_linearly < type_list , visited_fields <boost::mpl::arg<2> , boost::mpl::arg<1> > , empty_visited_field >::type { };