pop_front.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  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 <boost/detail/lightweight_test.hpp>
  7. #include <boost/fusion/container/vector/vector.hpp>
  8. #include <boost/fusion/adapted/mpl.hpp>
  9. #include <boost/fusion/sequence/io/out.hpp>
  10. #include <boost/fusion/sequence/comparison/equal_to.hpp>
  11. #include <boost/fusion/container/generation/make_vector.hpp>
  12. #include <boost/fusion/algorithm/transformation/pop_front.hpp>
  13. #include <boost/mpl/vector_c.hpp>
  14. int
  15. main()
  16. {
  17. using namespace boost::fusion;
  18. std::cout << tuple_open('[');
  19. std::cout << tuple_close(']');
  20. std::cout << tuple_delimiter(", ");
  21. /// Testing pop_front
  22. {
  23. char const* s = "Ruby";
  24. typedef vector<int, char, double, char const*> vector_type;
  25. vector_type t1(1, 'x', 3.3, s);
  26. {
  27. std::cout << pop_front(t1) << std::endl;
  28. BOOST_TEST((pop_front(t1) == make_vector('x', 3.3, s)));
  29. }
  30. }
  31. {
  32. typedef boost::mpl::vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
  33. std::cout << boost::fusion::pop_front(mpl_vec()) << std::endl;
  34. BOOST_TEST((boost::fusion::pop_front(mpl_vec()) == make_vector(2, 3, 4, 5)));
  35. }
  36. return boost::report_errors();
  37. }