deref_impl.hpp 1.4 KB

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