make_set.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*=============================================================================
  2. Copyright (c) 2014-2015 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_SET_11112014_2255
  7. #define FUSION_MAKE_SET_11112014_2255
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/container/set/set.hpp>
  10. #if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
  11. # include <boost/fusion/container/generation/detail/pp_make_set.hpp>
  12. #else
  13. ///////////////////////////////////////////////////////////////////////////////
  14. // C++11 variadic interface
  15. ///////////////////////////////////////////////////////////////////////////////
  16. #include <boost/fusion/support/detail/as_fusion_element.hpp>
  17. #include <boost/type_traits/remove_reference.hpp>
  18. #include <boost/type_traits/remove_const.hpp>
  19. #include <utility>
  20. namespace boost { namespace fusion
  21. {
  22. namespace result_of
  23. {
  24. template <typename ...T>
  25. struct make_set
  26. {
  27. typedef set<
  28. typename detail::as_fusion_element<
  29. typename remove_const<
  30. typename remove_reference<T>::type
  31. >::type
  32. >::type...
  33. > type;
  34. };
  35. }
  36. template <typename ...T>
  37. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  38. inline typename result_of::make_set<T...>::type
  39. make_set(T&&... arg)
  40. {
  41. return typename result_of::make_set<T...>::type(std::forward<T>(arg)...);
  42. }
  43. }}
  44. #endif
  45. #endif