// Copyright Louis Dionne 2013-2017 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) #ifndef TEST_SUPPORT_MINIMAL_PRODUCT_HPP #define TEST_SUPPORT_MINIMAL_PRODUCT_HPP #include #include #include #include struct MinimalProduct; template struct product_t { X fst; Y snd; using hana_tag = MinimalProduct; }; struct make_minimal_product { template constexpr product_t::type, typename std::decay::type> operator()(T&& t, U&& u) const { return {static_cast(t), static_cast(u)}; } }; constexpr make_minimal_product minimal_product{}; namespace boost { namespace hana { ////////////////////////////////////////////////////////////////////////// // Product ////////////////////////////////////////////////////////////////////////// template <> struct make_impl { template static constexpr auto apply(X x, Y y) { return ::minimal_product(x, y); } }; template <> struct first_impl { template static constexpr decltype(auto) apply(P&& p) { return p.fst; } }; template <> struct second_impl { template static constexpr decltype(auto) apply(P&& p) { return p.snd; } }; }} // end namespace boost::hana #endif // !TEST_SUPPORT_MINIMAL_PRODUCT_HPP