3
// Copyright Neil Groves 2009. 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)
9
// For more information, see http://www.boost.org/libs/range/
11
#include <mlib/tests/_pc_.h>
13
#include <mlib/range/adaptor/map.hpp>
14
#include <mlib/range/algorithm/copy.hpp>
15
#include <mlib/range/algorithm_ext/push_back.hpp>
17
#include <boost/assign.hpp>
25
void map_keys_example_test()
27
using namespace boost::assign;
28
using namespace boost::adaptors;
30
std::map<int,int> input;
31
for (int i = 0; i < 10; ++i)
32
input.insert(std::make_pair(i, i * 10));
36
// std::ostream_iterator<int>(std::cout, ","));
39
std::vector<int> reference;
40
reference += 0,1,2,3,4,5,6,7,8,9;
42
std::vector<int> test;
43
boost::push_back(test, input | map_keys);
45
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
46
test.begin(), test.end() );
50
BOOST_AUTO_TEST_CASE( test_range_map_keys_example_test )
52
map_keys_example_test();