create.hpp 935 B

123456789101112131415161718192021222324252627282930313233
  1. /*!
  2. @file
  3. Defines `boost::hana::detail::create`.
  4. @copyright Louis Dionne 2013-2017
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef BOOST_HANA_DETAIL_CREATE_HPP
  9. #define BOOST_HANA_DETAIL_CREATE_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/detail/decay.hpp>
  12. BOOST_HANA_NAMESPACE_BEGIN namespace detail {
  13. //! @ingroup group-details
  14. //! Implementation of the generic `std::make_xxx` pattern for arbitrary
  15. //! `xxx`s.
  16. template <template <typename ...> class T>
  17. struct create {
  18. template <typename ...X>
  19. constexpr T<typename detail::decay<X>::type...>
  20. operator()(X&& ...x) const {
  21. return T<typename detail::decay<X>::type...>{
  22. static_cast<X&&>(x)...
  23. };
  24. }
  25. };
  26. } BOOST_HANA_NAMESPACE_END
  27. #endif // !BOOST_HANA_DETAIL_CREATE_HPP