4 // Copyright 2014 Peter Dimov
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
11 #include <boost/visit_each.hpp>
12 #include <boost/core/lightweight_test.hpp>
21 template<class Visitor> inline void visit_each( Visitor & visitor, X const & x )
23 using boost::visit_each;
25 visit_each( visitor, x.v );
26 visit_each( visitor, x.w );
37 template< class T > void operator()( T const & t )
41 void operator()( int const & v )
46 void operator()( std::string const & w )
48 s_ = s_ * 10 + w.size();
58 using boost::visit_each;
62 BOOST_TEST( v.s_ == 54 );
64 return boost::report_errors();