/Src/Dependencies/Boost/boost/fusion/container/list/detail/deref_impl.hpp

http://hadesmem.googlecode.com/ · C++ Header · 52 lines · 36 code · 9 blank · 7 comment · 0 complexity · ddc665eb1ffa019733f2b6c826071e3b MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 2005 Joel de Guzman
  3. Copyright (c) 2005 Eric Niebler
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(FUSION_DEREF_IMPL_07172005_0831)
  8. #define FUSION_DEREF_IMPL_07172005_0831
  9. #include <boost/mpl/eval_if.hpp>
  10. #include <boost/type_traits/is_const.hpp>
  11. #include <boost/type_traits/add_const.hpp>
  12. #include <boost/type_traits/add_reference.hpp>
  13. namespace boost { namespace fusion
  14. {
  15. struct cons_iterator_tag;
  16. namespace extension
  17. {
  18. template <typename Tag>
  19. struct deref_impl;
  20. template <>
  21. struct deref_impl<cons_iterator_tag>
  22. {
  23. template <typename Iterator>
  24. struct apply
  25. {
  26. typedef typename Iterator::cons_type cons_type;
  27. typedef typename cons_type::car_type value_type;
  28. typedef typename mpl::eval_if<
  29. is_const<cons_type>
  30. , add_reference<typename add_const<value_type>::type>
  31. , add_reference<value_type> >::type
  32. type;
  33. static type
  34. call(Iterator const& i)
  35. {
  36. return i.cons.car;
  37. }
  38. };
  39. };
  40. }
  41. }}
  42. #endif