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/core/lightweight_test.hpp>
13#include <boost/foreach.hpp>
14
15///////////////////////////////////////////////////////////////////////////////
16// use FOREACH to iterate over a sequence with a dependent type
17template<typename Vector>
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//
31int main()
32{
33 std::vector<int> vect;
34 do_test(vect);
35
36 return boost::report_errors();
37}
38

source code of boost/libs/foreach/test/dependent_type.cpp