make_tuple.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*=============================================================================
  2. Copyright (c) 2014 Kohei Takahashi
  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. #ifndef FUSION_MAKE_TUPLE_14122014_0048
  7. #define FUSION_MAKE_TUPLE_14122014_0048
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/tuple/tuple_fwd.hpp>
  10. ///////////////////////////////////////////////////////////////////////////////
  11. // With no variadics, we will use the C++03 version
  12. ///////////////////////////////////////////////////////////////////////////////
  13. #if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
  14. # include <boost/fusion/tuple/detail/make_tuple.hpp>
  15. #else
  16. ///////////////////////////////////////////////////////////////////////////////
  17. // C++11 interface
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #include <boost/fusion/support/detail/as_fusion_element.hpp>
  20. #include <boost/fusion/tuple/tuple.hpp>
  21. #include <boost/type_traits/remove_reference.hpp>
  22. #include <boost/type_traits/remove_const.hpp>
  23. namespace boost { namespace fusion
  24. {
  25. template <typename ...T>
  26. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  27. inline tuple<typename detail::as_fusion_element<
  28. typename remove_const<
  29. typename remove_reference<T>::type
  30. >::type
  31. >::type...>
  32. make_tuple(T&&... arg)
  33. {
  34. typedef tuple<typename detail::as_fusion_element<
  35. typename remove_const<
  36. typename remove_reference<T>::type
  37. >::type
  38. >::type...> result_type;
  39. return result_type(std::forward<T>(arg)...);
  40. }
  41. }}
  42. #endif
  43. #endif