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