/*============================================================================= Copyright (c) 2017 Paul Fultz II combine.cpp Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #include #include "test.hpp" #include #include #include #include template struct mini_pair { T first; U second; template constexpr mini_pair(X&& x, Y&& y) : first(boost::hof::forward(x)), second(boost::hof::forward(y)) {} }; template constexpr bool operator==(const mini_pair& x, const mini_pair& y) { return x.first == y.first && x.second == y.second; } template constexpr mini_pair make_mini_pair(T x, U y) { return mini_pair(x, y); } BOOST_HOF_TEST_CASE() { BOOST_HOF_TEST_CHECK( boost::hof::combine( boost::hof::construct(), boost::hof::capture_basic(1)(boost::hof::construct()), boost::hof::capture_basic(2)(boost::hof::construct()) )(2, 4) == std::make_tuple(std::make_pair(1, 2), std::make_pair(2, 4))); } BOOST_HOF_TEST_CASE() { BOOST_HOF_TEST_CHECK( boost::hof::combine( boost::hof::construct(), boost::hof::capture_basic(1)(boost::hof::construct()), boost::hof::capture_basic(2)(boost::hof::construct()) )(2, 4) == make_mini_pair(make_mini_pair(1, 2), make_mini_pair(2, 4))); BOOST_HOF_STATIC_TEST_CHECK( boost::hof::combine( boost::hof::construct(), boost::hof::capture_basic(1)(boost::hof::construct()), boost::hof::capture_basic(2)(boost::hof::construct()) )(2, 4) == make_mini_pair(make_mini_pair(1, 2), make_mini_pair(2, 4))); }