value_of.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  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(FUSION_VALUE_OF_05052005_1126)
  7. #define FUSION_VALUE_OF_05052005_1126
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/support/iterator_base.hpp>
  10. #include <boost/fusion/support/tag_of.hpp>
  11. namespace boost { namespace fusion
  12. {
  13. // Special tags:
  14. struct iterator_facade_tag; // iterator facade tag
  15. struct boost_array_iterator_tag; // boost::array iterator tag
  16. struct mpl_iterator_tag; // mpl sequence iterator tag
  17. struct std_pair_iterator_tag; // std::pair iterator tag
  18. namespace extension
  19. {
  20. template <typename Tag>
  21. struct value_of_impl
  22. {
  23. template <typename Iterator>
  24. struct apply {};
  25. };
  26. template <>
  27. struct value_of_impl<iterator_facade_tag>
  28. {
  29. template <typename Iterator>
  30. struct apply : Iterator::template value_of<Iterator> {};
  31. };
  32. template <>
  33. struct value_of_impl<boost_array_iterator_tag>;
  34. template <>
  35. struct value_of_impl<mpl_iterator_tag>;
  36. template <>
  37. struct value_of_impl<std_pair_iterator_tag>;
  38. }
  39. namespace result_of
  40. {
  41. template <typename Iterator>
  42. struct value_of
  43. : extension::value_of_impl<typename detail::tag_of<Iterator>::type>::
  44. template apply<Iterator>
  45. {};
  46. }
  47. }}
  48. #endif