begin_impl.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2005-2006 Dan Marsden
  4. Copyright (c) 2009-2010 Christopher Schmidt
  5. Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. ==============================================================================*/
  8. #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_BEGIN_IMPL_HPP
  9. #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_BEGIN_IMPL_HPP
  10. #include <boost/fusion/iterator/basic_iterator.hpp>
  11. namespace boost { namespace fusion { namespace extension
  12. {
  13. template<typename>
  14. struct begin_impl;
  15. template <>
  16. struct begin_impl<struct_tag>
  17. {
  18. template <typename Seq>
  19. struct apply
  20. {
  21. typedef
  22. basic_iterator<
  23. struct_iterator_tag
  24. , random_access_traversal_tag
  25. , Seq
  26. , 0
  27. >
  28. type;
  29. static type
  30. call(Seq& seq)
  31. {
  32. return type(seq,0);
  33. }
  34. };
  35. };
  36. template <>
  37. struct begin_impl<assoc_struct_tag>
  38. {
  39. template <typename Seq>
  40. struct apply
  41. {
  42. typedef
  43. basic_iterator<
  44. struct_iterator_tag
  45. , assoc_struct_category
  46. , Seq
  47. , 0
  48. >
  49. type;
  50. static type
  51. call(Seq& seq)
  52. {
  53. return type(seq,0);
  54. }
  55. };
  56. };
  57. }}}
  58. #endif