1 /*============================================================================= 2 Copyright (c) 2004 Angus Leeming 3 Copyright (c) 2017 Kohei Takahashi 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 ==============================================================================*/ 8 #include "container_tests.hpp" 9 #include <boost/static_assert.hpp> 10 build_set()11std::set<int> const build_set() 12 { 13 typedef std::set<int> int_set; 14 typedef std::vector<int> int_vector; 15 16 int_set result; 17 int_vector const data = build_vector(); 18 int_vector::const_iterator it = data.begin(); 19 int_vector::const_iterator const end = data.end(); 20 result.insert(it, end); 21 return result; 22 } 23 build_multiset()24std::multiset<int> const build_multiset() 25 { 26 typedef std::set<int> int_set; 27 typedef std::multiset<int> int_multiset; 28 int_set const data = build_set(); 29 return int_multiset(data.begin(), data.end()); 30 } 31 init_vector()32std::vector<int> const init_vector() 33 { 34 typedef std::vector<int> int_vector; 35 int const data[] = { -4, -3, -2, -1, 0 }; 36 int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); 37 return int_vector(data, data + data_size); 38 } 39 build_vector()40std::vector<int> const build_vector() 41 { 42 typedef std::vector<int> int_vector; 43 static int_vector data = init_vector(); 44 int_vector::size_type const size = data.size(); 45 int_vector::iterator it = data.begin(); 46 int_vector::iterator const end = data.end(); 47 for (; it != end; ++it) 48 *it += size; 49 return data; 50 } 51 52 int main()53main() 54 { 55 BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::multiset<int> >::value)); 56 BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::multiset<int> >::value)); 57 58 std::multiset<int> const data = build_multiset(); 59 test_multiset_insert(data); 60 test_key_comp(data); 61 test_max_size(data); 62 test_rbegin(data); 63 test_rend(data); 64 test_size(data); 65 test_value_comp(data); 66 return boost::report_errors(); 67 } 68 69 70 71 72