convert_impl.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 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(FUSION_CONVERT_IMPL_09232005_1215)
  8. #define FUSION_CONVERT_IMPL_09232005_1215
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/container/list/cons.hpp>
  11. #include <boost/fusion/container/list/detail/build_cons.hpp>
  12. #include <boost/fusion/sequence/intrinsic/empty.hpp>
  13. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  14. #include <boost/fusion/sequence/intrinsic/end.hpp>
  15. namespace boost { namespace fusion
  16. {
  17. struct cons_tag;
  18. namespace extension
  19. {
  20. template <typename T>
  21. struct convert_impl;
  22. template <>
  23. struct convert_impl<cons_tag>
  24. {
  25. template <typename Sequence>
  26. struct apply
  27. {
  28. typedef typename
  29. detail::build_cons<
  30. typename result_of::begin<Sequence>::type
  31. , typename result_of::end<Sequence>::type
  32. >
  33. build_cons;
  34. typedef typename build_cons::type type;
  35. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  36. static type
  37. call(Sequence& seq)
  38. {
  39. return build_cons::call(fusion::begin(seq), fusion::end(seq));
  40. }
  41. };
  42. };
  43. }
  44. }}
  45. #endif