container_tests5a.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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::deque<int> const build_deque()
  8. {
  9. std::vector<int> const data = build_vector();
  10. return std::deque<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::deque<int> >::value));
  34. BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::deque<int> >::value));
  35. std::deque<int> const data = build_deque();
  36. test_assign(data);
  37. test_assign2(data);
  38. test_at(data);
  39. test_back(data);
  40. test_begin(data);
  41. test_clear(data);
  42. test_front(data);
  43. test_empty(data);
  44. test_end(data);
  45. test_erase(data);
  46. test_get_allocator(data);
  47. return boost::report_errors();
  48. }