deref_data.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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_ITERATOR_DEREF_DATA_HPP
  7. #define BOOST_FUSION_ITERATOR_DEREF_DATA_HPP
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/support/tag_of.hpp>
  10. namespace boost { namespace fusion
  11. {
  12. struct iterator_facade_tag;
  13. namespace extension
  14. {
  15. template <typename>
  16. struct deref_data_impl;
  17. template <>
  18. struct deref_data_impl<iterator_facade_tag>
  19. {
  20. template <typename It>
  21. struct apply
  22. : It::template deref_data<It>
  23. {};
  24. };
  25. }
  26. namespace result_of
  27. {
  28. template <typename It>
  29. struct deref_data
  30. : extension::deref_data_impl<typename traits::tag_of<It>::type>::
  31. template apply<It>
  32. {};
  33. }
  34. template <typename It>
  35. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  36. inline typename result_of::deref_data<It>::type
  37. deref_data(It const& it)
  38. {
  39. return result_of::deref_data<It>::call(it);
  40. }
  41. }}
  42. #endif