Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/range/test/compat3.cpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 1.3 KB
Line 
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/config.hpp>
14
15enum Container {};
16enum String {};
17
18template< typename T >
19struct range_iterator;
20
21template<>
22struct range_iterator<Container>
23{
24    template< typename C >
25    struct pts
26    {
27        typedef BOOST_DEDUCED_TYPENAME C::iterator type;
28    };
29};
30
31template<>
32struct range_iterator<String>
33{
34    template< typename C >
35    struct pts
36    {
37        typedef C type;
38    };
39};
40
41template< typename C >
42class iterator_of
43{
44public:
45    typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>:: template pts<C>::type type; 
46};
47
48#include <vector>
49
50void compat1()
51{
52    std::vector<int> v;
53    iterator_of< std::vector<int> >::type i = v.begin();
54}
55
56#include <boost/test/included/unit_test_framework.hpp> 
57
58using boost::unit_test_framework::test_suite;
59
60test_suite* init_unit_test_suite( int argc, char* argv[] )
61{
62    test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" );
63
64    test->add( BOOST_TEST_CASE( &compat1 ) );
65
66    return test;
67}
68
69
70
71
72
73
Note: See TracBrowser for help on using the repository browser.