• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2 @file
3 Defines `boost::hana::detail::create`.
4 
5 @copyright Louis Dionne 2013-2017
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 BOOST_HANA_NAMESPACE_BEGIN 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...>
operator ()detail::create25         operator()(X&& ...x) const {
26             return T<typename detail::decay<X>::type...>{
27                 static_cast<X&&>(x)...
28             };
29         }
30     };
31 } BOOST_HANA_NAMESPACE_END
32 
33 #endif // !BOOST_HANA_DETAIL_CREATE_HPP
34