make_cons.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2005 Eric Niebler
  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_MAKE_CONS_07172005_0918)
  8. #define FUSION_MAKE_CONS_07172005_0918
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/support/detail/as_fusion_element.hpp>
  11. #include <boost/fusion/container/list/cons.hpp>
  12. namespace boost { namespace fusion
  13. {
  14. struct nil_;
  15. namespace result_of
  16. {
  17. template <typename Car, typename Cdr = nil_>
  18. struct make_cons
  19. {
  20. typedef cons<typename detail::as_fusion_element<Car>::type, Cdr> type;
  21. };
  22. }
  23. template <typename Car>
  24. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  25. inline cons<typename detail::as_fusion_element<Car>::type>
  26. make_cons(Car const& car)
  27. {
  28. return cons<typename detail::as_fusion_element<Car>::type>(car);
  29. }
  30. template <typename Car, typename Cdr>
  31. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  32. inline cons<typename detail::as_fusion_element<Car>::type, Cdr>
  33. make_cons(Car const& car, Cdr const& cdr)
  34. {
  35. return cons<typename detail::as_fusion_element<Car>::type, Cdr>(car, cdr);
  36. }
  37. }}
  38. #endif