/* @copyright Louis Dionne 2015 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 using namespace boost::hana; int main() { { //! [comparing] constexpr auto grouped = group.by(comparing(length), make( make(1, 2, 3), make('x', 'y', 'z'), range_c, tuple_t, range_c, make(123.4, nullptr) )); static_assert(grouped == make( make( make(1, 2, 3), make('x', 'y', 'z') ), make( range_c ), make( tuple_t, range_c, make(123.4, nullptr) ) ), ""); //! [comparing] }{ //! [equal] static_assert(equal(make(1, 2), make(1, 2)), ""); static_assert(!equal('x', 'y'), ""); BOOST_HANA_CONSTANT_CHECK(!equal(make(1, 2), 'y')); static_assert(any_of(make(1, 2, 3), equal.to(2)), ""); //! [equal] }{ //! [not_equal] static_assert(not_equal(make(1, 2), make(3)), ""); static_assert(not_equal('x', 'y'), ""); BOOST_HANA_CONSTANT_CHECK(not_equal(make(1, 2), 'y')); static_assert(all_of(make(1, 2, 3), not_equal.to(5)), ""); //! [not_equal] } }