repetitive_view.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*=============================================================================
  2. Copyright (c) 2007 Tobias Schwinger
  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. #ifndef BOOST_FUSION_REPETITIVE_VIEW_REPETITIVE_VIEW_HPP_INCLUDED
  7. #define BOOST_FUSION_REPETITIVE_VIEW_REPETITIVE_VIEW_HPP_INCLUDED
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/type_traits/remove_reference.hpp>
  10. #include <boost/mpl/if.hpp>
  11. #include <boost/fusion/support/is_view.hpp>
  12. #include <boost/fusion/support/category_of.hpp>
  13. #include <boost/fusion/view/repetitive_view/detail/begin_impl.hpp>
  14. #include <boost/fusion/view/repetitive_view/detail/end_impl.hpp>
  15. namespace boost { namespace fusion
  16. {
  17. struct repetitive_view_tag;
  18. struct fusion_sequence_tag;
  19. template<typename Sequence> struct repetitive_view
  20. : sequence_base< repetitive_view<Sequence> >
  21. {
  22. typedef repetitive_view_tag fusion_tag;
  23. typedef fusion_sequence_tag tag; // this gets picked up by MPL
  24. typedef mpl::true_ is_view;
  25. typedef single_pass_traversal_tag category;
  26. typedef typename boost::remove_reference<Sequence>::type sequence_type;
  27. typedef typename
  28. mpl::if_<traits::is_view<Sequence>, Sequence, sequence_type&>::type
  29. stored_seq_type;
  30. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  31. repetitive_view(Sequence& in_seq)
  32. : seq(in_seq) {}
  33. stored_seq_type seq;
  34. private:
  35. // silence MSVC warning C4512: assignment operator could not be generated
  36. repetitive_view& operator= (repetitive_view const&);
  37. };
  38. }}
  39. #endif