container_tests2b.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*=============================================================================
  2. Copyright (c) 2004 Angus Leeming
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #include "container_tests.hpp"
  7. std::list<int> const build_list()
  8. {
  9. std::vector<int> const data = build_vector();
  10. return std::list<int>(data.begin(), data.end());
  11. }
  12. std::vector<int> const init_vector()
  13. {
  14. typedef std::vector<int> int_vector;
  15. int const data[] = { -4, -3, -2, -1, 0 };
  16. int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]);
  17. return int_vector(data, data + data_size);
  18. }
  19. std::vector<int> const build_vector()
  20. {
  21. typedef std::vector<int> int_vector;
  22. static int_vector data = init_vector();
  23. int_vector::size_type const size = data.size();
  24. int_vector::iterator it = data.begin();
  25. int_vector::iterator const end = data.end();
  26. for (; it != end; ++it)
  27. *it += size;
  28. return data;
  29. }
  30. int
  31. main()
  32. {
  33. BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::list<int> >::value));
  34. BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::list<int> >::value));
  35. std::list<int> const data = build_list();
  36. test_rbegin(data);
  37. test_rend(data);
  38. test_resize(data);
  39. test_size(data);
  40. test_splice(data);
  41. return boost::report_errors();
  42. }