convert.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*=============================================================================
  2. Copyright (c) 2005-2013 Joel de Guzman
  3. Copyright (c) 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(FUSION_CONVERT_20061213_2207)
  8. #define FUSION_CONVERT_20061213_2207
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/container/deque/detail/convert_impl.hpp>
  11. #include <boost/fusion/container/deque/deque.hpp>
  12. #if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
  13. ///////////////////////////////////////////////////////////////////////////////
  14. // C++03 (non-variadic) implementation
  15. ///////////////////////////////////////////////////////////////////////////////
  16. #include <boost/fusion/container/deque/detail/cpp03/build_deque.hpp>
  17. #else
  18. ///////////////////////////////////////////////////////////////////////////////
  19. // C++11 variadic implementation
  20. ///////////////////////////////////////////////////////////////////////////////
  21. #include <boost/fusion/container/deque/detail/build_deque.hpp>
  22. namespace boost { namespace fusion
  23. {
  24. namespace result_of
  25. {
  26. template <typename Sequence>
  27. struct as_deque :
  28. detail::build_deque<
  29. typename result_of::begin<Sequence>::type
  30. , typename result_of::end<Sequence>::type
  31. >
  32. {
  33. };
  34. }
  35. template <typename Sequence>
  36. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  37. inline typename result_of::as_deque<Sequence>::type
  38. as_deque(Sequence& seq)
  39. {
  40. typedef result_of::as_deque<Sequence> gen;
  41. return gen::call(fusion::begin(seq), fusion::end(seq));
  42. }
  43. template <typename Sequence>
  44. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  45. inline typename result_of::as_deque<Sequence const>::type
  46. as_deque(Sequence const& seq)
  47. {
  48. typedef result_of::as_deque<Sequence const> gen;
  49. return gen::call(fusion::begin(seq), fusion::end(seq));
  50. }
  51. }}
  52. #endif
  53. #endif