/Src/Dependencies/Boost/libs/phoenix/test/container/container_tests4a.cpp

http://hadesmem.googlecode.com/ · C++ · 47 lines · 37 code · 4 blank · 6 comment · 2 complexity · ac55aeeb97c2b13b53f2117f876bcb8c MD5 · raw file

  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. std::vector<int> const data = build_vector();
  30. test_assign(data);
  31. test_assign2(data);
  32. test_at(data);
  33. test_back(data);
  34. test_begin(data);
  35. test_capacity(data);
  36. test_clear(data);
  37. test_end(data);
  38. test_empty(data);
  39. test_erase(data);
  40. test_front(data);
  41. return boost::report_errors();
  42. }