deref_impl.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*=============================================================================
  2. Copyright (c) 2009 Hartmut Kaiser
  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. #if !defined(BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM)
  7. #define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM
  8. #include <boost/fusion/iterator/deref.hpp>
  9. #include <boost/fusion/container/vector.hpp>
  10. namespace boost { namespace fusion
  11. {
  12. struct nview_iterator_tag;
  13. namespace extension
  14. {
  15. template<typename Tag>
  16. struct deref_impl;
  17. template<>
  18. struct deref_impl<nview_iterator_tag>
  19. {
  20. template<typename Iterator>
  21. struct apply
  22. {
  23. typedef typename Iterator::first_type first_type;
  24. typedef typename Iterator::sequence_type sequence_type;
  25. typedef typename result_of::deref<first_type>::type index;
  26. typedef typename result_of::at<
  27. typename sequence_type::sequence_type, index>::type type;
  28. static type call(Iterator const& i)
  29. {
  30. return at<index>(i.seq.seq);
  31. }
  32. };
  33. };
  34. }
  35. }}
  36. #endif