// 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) #include #include #include #include #include namespace hana = boost::hana; template struct F { struct type; }; struct x0; struct x1; struct x2; struct x3; int main() { // tuple_t and an initial state { auto f = hana::metafunction; auto s = hana::type_c; BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t<>, s, f), s )); BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t, s, f), f(hana::type_c, s) )); BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t, s, f), f(hana::type_c, f(hana::type_c, s)) )); BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t, s, f), f(hana::type_c, f(hana::type_c, f(hana::type_c, s))) )); BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t, s, f), f(hana::type_c, f(hana::type_c, f(hana::type_c, f(hana::type_c, s)))) )); } // tuple_t and no initial state { auto f = hana::metafunction; BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t, f), hana::type_c )); BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t, f), f(hana::type_c, hana::type_c) )); BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t, f), f(hana::type_c, f(hana::type_c, hana::type_c)) )); BOOST_HANA_CONSTANT_CHECK(hana::equal( hana::fold_right(hana::tuple_t, f), f(hana::type_c, f(hana::type_c, f(hana::type_c, hana::type_c))) )); } }