convert.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_CONVERT_09232005_1215)
  7. #define FUSION_CONVERT_09232005_1215
  8. #include <boost/fusion/container/list/cons.hpp>
  9. #include <boost/fusion/container/list/detail/build_cons.hpp>
  10. #include <boost/fusion/container/list/detail/convert_impl.hpp>
  11. #include <boost/fusion/sequence/intrinsic/empty.hpp>
  12. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  13. #include <boost/fusion/sequence/intrinsic/end.hpp>
  14. namespace boost { namespace fusion
  15. {
  16. namespace result_of
  17. {
  18. template <typename Sequence>
  19. struct as_list
  20. {
  21. typedef typename
  22. detail::build_cons<
  23. typename result_of::begin<Sequence>::type
  24. , typename result_of::end<Sequence>::type
  25. >
  26. build_cons;
  27. typedef typename build_cons::type type;
  28. static type
  29. call(Sequence& seq)
  30. {
  31. return build_cons::call(fusion::begin(seq), fusion::end(seq));
  32. }
  33. };
  34. }
  35. template <typename Sequence>
  36. inline typename result_of::as_list<Sequence>::type
  37. as_list(Sequence& seq)
  38. {
  39. return result_of::as_list<Sequence>::call(seq);
  40. }
  41. template <typename Sequence>
  42. inline typename result_of::as_list<Sequence const>::type
  43. as_list(Sequence const& seq)
  44. {
  45. return result_of::as_list<Sequence const>::call(seq);
  46. }
  47. }}
  48. #endif