zip.cpp 1.2 KB

123456789101112131415161718192021222324252627282930
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2006 Dan Marsden
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #include <boost/detail/lightweight_test.hpp>
  8. #include <boost/fusion/algorithm/transformation/zip.hpp>
  9. #include <boost/fusion/container/generation/make_vector.hpp>
  10. #include <boost/fusion/sequence/comparison/equal_to.hpp>
  11. #include <boost/fusion/adapted/mpl.hpp>
  12. #include <boost/mpl/vector.hpp>
  13. int main()
  14. {
  15. using namespace boost::fusion;
  16. {
  17. BOOST_TEST(zip(make_vector(1,2), make_vector('a','b')) == make_vector(make_vector(1,'a'), make_vector(2,'b')));
  18. BOOST_TEST(
  19. zip(
  20. make_vector(1,2),
  21. make_vector('a','b'),
  22. make_vector(-1,-2))
  23. == make_vector(
  24. make_vector(1,'a',-1),
  25. make_vector(2,'b',-2))); // Zip more than 2 sequences
  26. }
  27. return boost::report_errors();
  28. }