repetitive_view.hpp 1.7 KB

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