container_tests4b.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #include <boost/static_assert.hpp>
  8. std::vector<int> const init_vector()
  9. {
  10. typedef std::vector<int> int_vector;
  11. int const data[] = { -4, -3, -2, -1, 0 };
  12. int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]);
  13. return int_vector(data, data + data_size);
  14. }
  15. std::vector<int> const build_vector()
  16. {
  17. typedef std::vector<int> int_vector;
  18. static int_vector data = init_vector();
  19. int_vector::size_type const size = data.size();
  20. int_vector::iterator it = data.begin();
  21. int_vector::iterator const end = data.end();
  22. for (; it != end; ++it)
  23. *it += size;
  24. return data;
  25. }
  26. int
  27. main()
  28. {
  29. BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::vector<int> >::value));
  30. BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::vector<int> >::value));
  31. std::vector<int> const data = build_vector();
  32. test_get_allocator(data);
  33. test_insert(data);
  34. test_max_size(data);
  35. test_pop_back(data);
  36. test_push_back(data);
  37. test_rbegin(data);
  38. test_rend(data);
  39. test_reserve(data);
  40. test_resize(data);
  41. test_size(data);
  42. return boost::report_errors();
  43. }