value_of_impl.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2018 Kohei Takahashi
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(FUSION_VALUE_OF_IMPL_07162005_1030)
  8. #define FUSION_VALUE_OF_IMPL_07162005_1030
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/iterator/value_of.hpp>
  11. #include <boost/utility/result_of.hpp>
  12. namespace boost { namespace fusion
  13. {
  14. struct transform_view_iterator_tag;
  15. struct transform_view_iterator2_tag;
  16. namespace extension
  17. {
  18. template <typename Tag>
  19. struct value_of_impl;
  20. // Unary Version
  21. template <>
  22. struct value_of_impl<transform_view_iterator_tag>
  23. {
  24. template <typename Iterator>
  25. struct apply
  26. {
  27. typedef typename
  28. result_of::value_of<typename Iterator::first_type>::type
  29. value_type;
  30. typedef typename Iterator::transform_type F;
  31. typedef typename boost::result_of<F(value_type)>::type type;
  32. };
  33. };
  34. // Binary Version
  35. template <>
  36. struct value_of_impl<transform_view_iterator2_tag>
  37. {
  38. template <typename Iterator>
  39. struct apply
  40. {
  41. typedef typename
  42. result_of::value_of<typename Iterator::first1_type>::type
  43. value1_type;
  44. typedef typename
  45. result_of::value_of<typename Iterator::first2_type>::type
  46. value2_type;
  47. typedef typename Iterator::transform_type F;
  48. typedef typename boost::result_of<F(value1_type, value2_type)>::type type;
  49. };
  50. };
  51. }
  52. }}
  53. #endif