deref_impl.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_SET_DETAIL_DEREF_IMPL_HPP
  7. #define BOOST_FUSION_CONTAINER_SET_DETAIL_DEREF_IMPL_HPP
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/sequence/intrinsic/at.hpp>
  10. #include <boost/type_traits/is_const.hpp>
  11. namespace boost { namespace fusion { namespace extension
  12. {
  13. template <typename>
  14. struct deref_impl;
  15. template <>
  16. struct deref_impl<set_iterator_tag>
  17. {
  18. template <typename It>
  19. struct apply
  20. {
  21. typedef typename
  22. result_of::at<
  23. typename mpl::if_<
  24. is_const<typename It::seq_type>
  25. , typename It::seq_type::storage_type const
  26. , typename It::seq_type::storage_type
  27. >::type
  28. , typename It::index
  29. >::type
  30. type;
  31. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  32. static type
  33. call(It const& it)
  34. {
  35. return ::boost::fusion::at<typename It::index>(it.seq->get_data());
  36. }
  37. };
  38. };
  39. }}}
  40. #endif