deref_data_impl.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*=============================================================================
  2. Copyright (c) 2009 Christopher Schmidt
  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. #ifndef BOOST_FUSION_CONTAINER_MAP_DETAIL_DEREF_DATA_IMPL_HPP
  7. #define BOOST_FUSION_CONTAINER_MAP_DETAIL_DEREF_DATA_IMPL_HPP
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/iterator/value_of.hpp>
  10. #include <boost/fusion/iterator/deref.hpp>
  11. #include <boost/fusion/support/detail/access.hpp>
  12. #include <boost/type_traits/is_const.hpp>
  13. #include <boost/mpl/if.hpp>
  14. namespace boost { namespace fusion { namespace extension
  15. {
  16. template <typename>
  17. struct deref_data_impl;
  18. template <>
  19. struct deref_data_impl<map_iterator_tag>
  20. {
  21. template <typename It>
  22. struct apply
  23. {
  24. typedef typename result_of::value_of<It>::type::second_type data;
  25. typedef typename
  26. mpl::if_<
  27. is_const<typename It::seq_type>
  28. , typename detail::cref_result<data>::type
  29. , typename detail::ref_result<data>::type
  30. >::type
  31. type;
  32. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  33. static type
  34. call(It const& it)
  35. {
  36. return fusion::deref(it).second;
  37. }
  38. };
  39. };
  40. }}}
  41. #endif