pop_front.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  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(FUSION_POP_FRONT_09172005_1115)
  7. #define FUSION_POP_FRONT_09172005_1115
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/view/iterator_range/iterator_range.hpp>
  10. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  11. #include <boost/fusion/sequence/intrinsic/end.hpp>
  12. #include <boost/fusion/iterator/next.hpp>
  13. namespace boost { namespace fusion
  14. {
  15. namespace result_of
  16. {
  17. template <typename Sequence>
  18. struct pop_front
  19. {
  20. typedef
  21. iterator_range<
  22. typename next<
  23. typename begin<Sequence>::type
  24. >::type
  25. , typename end<Sequence>::type
  26. >
  27. type;
  28. };
  29. }
  30. template <typename Sequence>
  31. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  32. inline typename result_of::pop_front<Sequence const>::type
  33. pop_front(Sequence const& seq)
  34. {
  35. typedef typename result_of::pop_front<Sequence const>::type result;
  36. return result(fusion::next(fusion::begin(seq)), fusion::end(seq));
  37. }
  38. }}
  39. #endif