front.hpp 1.3 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_FRONT_09162005_0343)
  7. #define FUSION_FRONT_09162005_0343
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/sequence/intrinsic_fwd.hpp>
  10. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  11. #include <boost/fusion/iterator/deref.hpp>
  12. #include <boost/mpl/bool.hpp>
  13. namespace boost { namespace fusion
  14. {
  15. struct fusion_sequence_tag;
  16. namespace result_of
  17. {
  18. template <typename Sequence>
  19. struct front
  20. : result_of::deref<typename result_of::begin<Sequence>::type>
  21. {};
  22. }
  23. template <typename Sequence>
  24. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  25. inline typename result_of::front<Sequence>::type
  26. front(Sequence& seq)
  27. {
  28. return *fusion::begin(seq);
  29. }
  30. template <typename Sequence>
  31. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  32. inline typename result_of::front<Sequence const>::type
  33. front(Sequence const& seq)
  34. {
  35. return *fusion::begin(seq);
  36. }
  37. }}
  38. #endif