1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
5 #ifndef TEST_SUPPORT_MINIMAL_PRODUCT_HPP
6 #define TEST_SUPPORT_MINIMAL_PRODUCT_HPP
8 #include <boost/hana/fwd/core/make.hpp>
9 #include <boost/hana/fwd/first.hpp>
10 #include <boost/hana/fwd/second.hpp>
12 #include <type_traits>
15 struct MinimalProduct;
17 template <typename X, typename Y>
21 using hana_tag = MinimalProduct;
24 struct make_minimal_product {
25 template <typename T, typename U>
26 constexpr product_t<typename std::decay<T>::type,
27 typename std::decay<U>::type>
28 operator()(T&& t, U&& u) const {
29 return {static_cast<T&&>(t), static_cast<U&&>(u)};
33 constexpr make_minimal_product minimal_product{};
35 namespace boost { namespace hana {
36 //////////////////////////////////////////////////////////////////////////
38 //////////////////////////////////////////////////////////////////////////
40 struct make_impl<MinimalProduct> {
41 template <typename X, typename Y>
42 static constexpr auto apply(X x, Y y)
43 { return ::minimal_product(x, y); }
47 struct first_impl<MinimalProduct> {
49 static constexpr decltype(auto) apply(P&& p)
54 struct second_impl<MinimalProduct> {
56 static constexpr decltype(auto) apply(P&& p)
59 }} // end namespace boost::hana
61 #endif // !TEST_SUPPORT_MINIMAL_PRODUCT_HPP