1 // (C) Copyright Eric Niebler 2005. 2 // Use, modification and distribution are subject to the 3 // Boost Software License, Version 1.0. (See accompanying file 4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 /* 7 Revision history: 8 26 August 2005 : Initial version. 9 */ 10 11 #include <vector> 12 #include <boost/test/minimal.hpp> 13 #include <boost/foreach.hpp> 14 15 /////////////////////////////////////////////////////////////////////////////// 16 // use FOREACH to iterate over a sequence with a dependent type 17 template<typename Vector> do_test(Vector const & vect)18void do_test(Vector const & vect) 19 { 20 typedef BOOST_DEDUCED_TYPENAME Vector::value_type value_type; 21 BOOST_FOREACH(value_type i, vect) 22 { 23 // no-op, just make sure this compiles 24 ((void)i); 25 } 26 } 27 28 /////////////////////////////////////////////////////////////////////////////// 29 // test_main 30 // test_main(int,char * [])31int test_main( int, char*[] ) 32 { 33 std::vector<int> vect; 34 do_test(vect); 35 36 return 0; 37 } 38