value_of_impl.hpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2006 Dan Marsden
  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_20060124_2147)
  8. #define FUSION_VALUE_OF_IMPL_20060124_2147
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/container/vector/convert.hpp>
  11. #include <boost/fusion/algorithm/transformation/transform.hpp>
  12. #include <boost/fusion/iterator/value_of.hpp>
  13. #include <boost/mpl/placeholders.hpp>
  14. #include <boost/fusion/support/unused.hpp>
  15. #include <boost/mpl/eval_if.hpp>
  16. #include <boost/mpl/identity.hpp>
  17. #include <boost/type_traits/is_same.hpp>
  18. #include <boost/config.hpp>
  19. namespace boost { namespace fusion
  20. {
  21. struct zip_view_iterator_tag;
  22. namespace detail
  23. {
  24. struct poly_value_of
  25. {
  26. template<typename T>
  27. struct result;
  28. template<typename It>
  29. struct result<poly_value_of(It)>
  30. : mpl::eval_if<is_same<It, unused_type>,
  31. mpl::identity<unused_type>,
  32. result_of::value_of<It> >
  33. {};
  34. // never called, but needed for decltype-based result_of (C++0x)
  35. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  36. template<typename It>
  37. BOOST_FUSION_GPU_ENABLED
  38. typename result<poly_value_of(It)>::type
  39. operator()(It&&) const;
  40. #endif
  41. };
  42. }
  43. namespace extension
  44. {
  45. template<typename Tag>
  46. struct value_of_impl;
  47. template<>
  48. struct value_of_impl<zip_view_iterator_tag>
  49. {
  50. template<typename Iterator>
  51. struct apply
  52. {
  53. typedef typename result_of::transform<
  54. typename Iterator::iterators,
  55. detail::poly_value_of>::type values;
  56. typedef typename result_of::as_vector<values>::type type;
  57. };
  58. };
  59. }
  60. }}
  61. #endif