begin_impl.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*=============================================================================
  2. Copyright (c) 2005-2012 Joel de Guzman
  3. Copyright (c) 2005-2006 Dan Marsden
  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(BOOST_FUSION_DEQUE_BEGIN_IMPL_09122006_2034)
  8. #define BOOST_FUSION_DEQUE_BEGIN_IMPL_09122006_2034
  9. #include <boost/fusion/container/deque/deque_iterator.hpp>
  10. #include <boost/mpl/equal_to.hpp>
  11. #include <boost/mpl/if.hpp>
  12. namespace boost { namespace fusion
  13. {
  14. struct deque_tag;
  15. namespace extension
  16. {
  17. template<typename T>
  18. struct begin_impl;
  19. template<>
  20. struct begin_impl<deque_tag>
  21. {
  22. template<typename Sequence>
  23. struct apply
  24. {
  25. typedef typename
  26. mpl::if_c<
  27. (Sequence::next_down::value == Sequence::next_up::value)
  28. , deque_iterator<Sequence, 0>
  29. , deque_iterator<Sequence, (Sequence::next_down::value + 1)>
  30. >::type
  31. type;
  32. static type call(Sequence& seq)
  33. {
  34. return type(seq);
  35. }
  36. };
  37. };
  38. }
  39. }}
  40. #endif