container_tests4a.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. #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_assign(data);
  33. test_assign2(data);
  34. test_at(data);
  35. test_back(data);
  36. test_begin(data);
  37. test_capacity(data);
  38. test_clear(data);
  39. test_end(data);
  40. test_empty(data);
  41. test_erase(data);
  42. test_front(data);
  43. return boost::report_errors();
  44. }