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)
8 // For more information, see http://www.boost.org/libs/range/
12 #include <boost/detail/workaround.hpp>
14 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
15 # pragma warn -8091 // suppress warning in Boost.Test
16 # pragma warn -8057 // unused argument argc/argv in Boost.Test
19 #include <boost/range.hpp>
20 #include <boost/test/test_tools.hpp>
21 #include <boost/test/unit_test.hpp>
25 // Generic range algorithm
28 typename
boost::range_iterator
<Rng
>::type
foo_algo( Rng
& r
)
31 // This will only compile for Rng = UDT if the qualified calls
32 // find boost_range_XXX via ADL.
34 return boost::size(r
) == 0u ? boost::begin(r
) : boost::end(r
);
46 typedef std::vector
<int> data_t
;
47 typedef data_t::iterator iterator
;
48 typedef data_t::const_iterator const_iterator
;
52 void push_back( int i
)
57 // The required functions. No type-traits need
58 // to be defined because X defines the proper set of
61 inline X::iterator
range_begin( X
& x
)
67 inline X::const_iterator
range_begin( const X
& x
)
73 inline X::iterator
range_end( X
& x
)
78 inline X::const_iterator
range_end( const X
& x
)
85 void check_extension()
95 using boost::unit_test::test_suite
;
97 test_suite
* init_unit_test_suite( int argc
, char* argv
[] )
99 test_suite
* test
= BOOST_TEST_SUITE( "Range Test Suite" );
101 test
->add( BOOST_TEST_CASE( &check_extension
) );