Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / range / test / compat2.cpp
1 // Boost.Range library
2 //
3 //  Copyright Thorsten Ottosen 2003-2004. Use, modification and
4 //  distribution is subject to the Boost Software License, Version
5 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 //  http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // For more information, see http://www.boost.org/libs/range/
9 //
10
11 #include <boost/static_assert.hpp>
12 #include <boost/type_traits.hpp>
13 #include <boost/concept_check.hpp>
14 #include <boost/config.hpp>
15
16 enum Container {};
17 enum String {};
18
19 template< typename T >
20 struct range_iterator;
21
22 template<>
23 struct range_iterator<Container>
24 {
25     template< typename C >
26     struct pts
27     {
28         typedef BOOST_DEDUCED_TYPENAME C::iterator type;
29     };
30 };
31
32 template<>
33 struct range_iterator<String>
34 {
35     template< typename C >
36     struct pts
37     {
38         typedef C type;
39     };
40 };
41
42 template< typename C >
43 class iterator_of
44 {
45 public:
46     typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::BOOST_NESTED_TEMPLATE pts<C>::type type; 
47 };
48
49 #include <vector>
50
51 void compat1()
52 {
53     std::vector<int> v;
54     iterator_of< std::vector<int> >::type i = v.begin();
55     boost::ignore_unused_variable_warning(i);
56 }
57
58 #include <boost/test/included/unit_test.hpp> 
59
60 using boost::unit_test::test_suite;
61
62 test_suite* init_unit_test_suite( int argc, char* argv[] )
63 {
64     test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" );
65
66     test->add( BOOST_TEST_CASE( &compat1 ) );
67
68     return test;
69 }
70
71
72
73
74
75