vector_iteration.cpp 1023 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*=============================================================================
  2. Copyright (c) 2008 Dan Marsden
  3. Use modification and distribution are subject to the Boost Software
  4. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ==============================================================================*/
  7. #include <boost/fusion/include/vector.hpp>
  8. #include <boost/fusion/include/for_each.hpp>
  9. namespace fusion = boost::fusion;
  10. namespace
  11. {
  12. template<int n, int batch>
  13. struct distinct
  14. {};
  15. struct null_op
  16. {
  17. template<typename T>
  18. void operator()(T const& t) const
  19. {}
  20. };
  21. template<int batch>
  22. void test()
  23. {
  24. fusion::vector<
  25. distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
  26. distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
  27. fusion::for_each(v, null_op());
  28. }
  29. }
  30. #include "./driver.hpp"