123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813 |
- /*=============================================================================
- Copyright (c) 2017 Paul Fultz II
- placeholders.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 <boost/hof/placeholders.hpp>
- #include "test.hpp"
- #include <sstream>
- // TODO: Test assign operators
- #if BOOST_HOF_HAS_STATIC_TEST_CHECK
- #define BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR constexpr
- #else
- #define BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR
- #endif
- struct square
- {
- template<class T>
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto operator()(T x) const BOOST_HOF_RETURNS(x*x);
- };
- #define CHECK_DEFAULT_CONSTRUCTION_OP(op, name) \
- static_assert(boost::hof::detail::is_default_constructible<boost::hof::operators::name>::value, "Operator not default constructible");
- #if BOOST_HOF_HAS_NOEXCEPT_DEDUCTION
- #define PLACEHOLDER_CHECK(...) \
- BOOST_HOF_STATIC_TEST_CHECK(__VA_ARGS__); \
- BOOST_HOF_TEST_CHECK(__VA_ARGS__); \
- static_assert(noexcept(__VA_ARGS__), "noexcept placeholders")
- #else
- #define PLACEHOLDER_CHECK(...) \
- BOOST_HOF_STATIC_TEST_CHECK(__VA_ARGS__); \
- BOOST_HOF_TEST_CHECK(__VA_ARGS__)
- #endif
- BOOST_HOF_TEST_CASE()
- {
- static_assert(boost::hof::detail::is_default_constructible<boost::hof::placeholder<1>>::value, "Placeholder not default constructible");
- static_assert(boost::hof::detail::is_default_constructible<boost::hof::placeholder<2>>::value, "Placeholder not default constructible");
- static_assert(boost::hof::detail::is_default_constructible<boost::hof::placeholder<3>>::value, "Placeholder not default constructible");
- BOOST_HOF_FOREACH_BINARY_OP(CHECK_DEFAULT_CONSTRUCTION_OP)
- BOOST_HOF_FOREACH_ASSIGN_OP(CHECK_DEFAULT_CONSTRUCTION_OP)
- BOOST_HOF_FOREACH_UNARY_OP(CHECK_DEFAULT_CONSTRUCTION_OP)
- }
- BOOST_HOF_TEST_CASE()
- {
- auto simple_print = boost::hof::reveal(std::ref(std::cout) << boost::hof::_);
- simple_print("Hello");
- }
- BOOST_HOF_TEST_CASE()
- {
- std::stringstream ss;
- auto simple_print = boost::hof::reveal(std::ref(ss) << boost::hof::_);
- simple_print("Hello");
- BOOST_HOF_TEST_CHECK(ss.str() == "Hello");
- }
- BOOST_HOF_TEST_CASE()
- {
- const auto x_square_add = 2 + (4*4);
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_square_add = boost::hof::_1 + boost::hof::lazy(square())(boost::hof::_2);
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_square_add)>::value, "Not copyable");
- #endif
- PLACEHOLDER_CHECK(f_square_add(2, 4) == x_square_add);
- }
- BOOST_HOF_TEST_CASE()
- {
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_invoke_2 = boost::hof::_1(3);
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_invoke_2)>::value, "Not copyable");
- #endif
- PLACEHOLDER_CHECK(f_invoke_2(square()) == 9);
- }
- BOOST_HOF_TEST_CASE()
- {
- const auto x_add = 2 + 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_add = boost::hof::_1 + boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_add)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_add)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_add(2, 1) == x_add);
- const auto x_subtract = 2 - 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_subtract = boost::hof::_1 - boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_subtract)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_subtract)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_subtract(2, 1) == x_subtract);
- const auto x_multiply = 2 * 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_multiply = boost::hof::_1 * boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_multiply)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_multiply)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_multiply(2, 1) == x_multiply);
- const auto x_divide = 2 / 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_divide = boost::hof::_1 / boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_divide)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_divide)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_divide(2, 1) == x_divide);
- const auto x_remainder = 2 % 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_remainder = boost::hof::_1 % boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_remainder)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_remainder)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_remainder(2, 1) == x_remainder);
- const auto x_shift_right = 2 >> 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_right = boost::hof::_1 >> boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_shift_right)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_shift_right)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_shift_right(2, 1) == x_shift_right);
- const auto x_shift_left = 2 << 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_left = boost::hof::_1 << boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_shift_left)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_shift_left)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_shift_left(2, 1) == x_shift_left);
- const auto x_greater_than = 2 > 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than = boost::hof::_1 > boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_greater_than)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_greater_than)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_greater_than(2, 1) == x_greater_than);
- const auto x_less_than = 2 < 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than = boost::hof::_1 < boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_less_than)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_less_than)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_less_than(2, 1) == x_less_than);
- const auto x_less_than_equal = 2 <= 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than_equal = boost::hof::_1 <= boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_less_than_equal)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_less_than_equal)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_less_than_equal(2, 1) == x_less_than_equal);
- const auto x_greater_than_equal = 2 >= 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than_equal = boost::hof::_1 >= boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_greater_than_equal)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_greater_than_equal)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_greater_than_equal(2, 1) == x_greater_than_equal);
- const auto x_equal = 2 == 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_equal = boost::hof::_1 == boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_equal)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_equal)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_equal(2, 1) == x_equal);
- const auto x_not_equal = 2 != 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_equal = boost::hof::_1 != boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_not_equal)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_equal)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_not_equal(2, 1) == x_not_equal);
- const auto x_bit_and = 2 & 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_and = boost::hof::_1 & boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_bit_and)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_bit_and)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_bit_and(2, 1) == x_bit_and);
- const auto x_xor_ = 2 ^ 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_xor_ = boost::hof::_1 ^ boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_xor_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_xor_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_xor_(2, 1) == x_xor_);
- const auto x_bit_or = 2 | 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_or = boost::hof::_1 | boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_bit_or)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_bit_or)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_bit_or(2, 1) == x_bit_or);
- const auto x_and_ = true && false;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_and_ = boost::hof::_1 && boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_and_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_and_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_and_(true, false) == x_and_);
- const auto x_or_ = true;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_or_ = boost::hof::_1 || boost::hof::_2;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_or_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_or_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_or_(true, false) == x_or_);
- }
- BOOST_HOF_TEST_CASE()
- {
- const auto x_not_ = !false;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_ = !boost::hof::_1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_not_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_not_(false) == x_not_);
- const auto x_not_0 = !0;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_0 = !boost::hof::_1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_not_0)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_0)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_not_0(0) == x_not_0);
- const auto x_compl_ = ~2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_compl_ = ~boost::hof::_1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_compl_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_compl_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_compl_(2) == x_compl_);
- const auto x_unary_plus = +2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_unary_plus = +boost::hof::_1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_unary_plus)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_unary_plus)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_unary_plus(2) == x_unary_plus);
- const auto x_unary_subtract = -2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_unary_subtract = -boost::hof::_1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_unary_subtract)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_unary_subtract)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_unary_subtract(2) == x_unary_subtract);
- const auto x_dereference = 2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_dereference = *boost::hof::_1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_dereference)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_dereference)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_dereference(&x_dereference) == x_dereference);
- // TODO: Test BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR increment and decrement
- #ifndef _MSC_VER
- auto x_increment = 2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_increment = ++boost::hof::_1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_increment)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_increment)>::value, "Not default constructible");
- f_increment(x_increment);
- BOOST_HOF_TEST_CHECK(x_increment == 3);
- auto x_decrement = 2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_decrement = --boost::hof::_1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_decrement)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_decrement)>::value, "Not default constructible");
- f_decrement(x_decrement);
- BOOST_HOF_TEST_CHECK(x_decrement == 1);
- #endif
- // TODO: Test post increment and decrement
- }
- BOOST_HOF_TEST_CASE()
- {
- const auto x_add = 2 + 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_add = boost::hof::_ + boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_add)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_add)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_add(2, 1) == x_add);
- const auto x_subtract = 2 - 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_subtract = boost::hof::_ - boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_subtract)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_subtract)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_subtract(2, 1) == x_subtract);
- const auto x_multiply = 2 * 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_multiply = boost::hof::_ * boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_multiply)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_multiply)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_multiply(2, 1) == x_multiply);
- const auto x_divide = 2 / 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_divide = boost::hof::_ / boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_divide)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_divide)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_divide(2, 1) == x_divide);
- const auto x_remainder = 2 % 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_remainder = boost::hof::_ % boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_remainder)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_remainder)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_remainder(2, 1) == x_remainder);
- const auto x_shift_right = 2 >> 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_right = boost::hof::_ >> boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_shift_right)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_shift_right)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_shift_right(2, 1) == x_shift_right);
- const auto x_shift_left = 2 << 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_left = boost::hof::_ << boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_shift_left)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_shift_left)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_shift_left(2, 1) == x_shift_left);
- const auto x_greater_than = 2 > 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than = boost::hof::_ > boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_greater_than)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_greater_than)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_greater_than(2, 1) == x_greater_than);
- const auto x_less_than = 2 < 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than = boost::hof::_ < boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_less_than)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_less_than)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_less_than(2, 1) == x_less_than);
- const auto x_less_than_equal = 2 <= 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than_equal = boost::hof::_ <= boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_less_than_equal)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_less_than_equal)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_less_than_equal(2, 1) == x_less_than_equal);
- const auto x_greater_than_equal = 2 >= 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than_equal = boost::hof::_ >= boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_greater_than_equal)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_greater_than_equal)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_greater_than_equal(2, 1) == x_greater_than_equal);
- const auto x_equal = 2 == 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_equal = boost::hof::_ == boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_equal)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_equal)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_equal(2, 1) == x_equal);
- const auto x_not_equal = 2 != 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_equal = boost::hof::_ != boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_not_equal)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_equal)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_not_equal(2, 1) == x_not_equal);
- const auto x_bit_and = 2 & 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_and = boost::hof::_ & boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_bit_and)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_bit_and)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_bit_and(2, 1) == x_bit_and);
- const auto x_xor_ = 2 ^ 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_xor_ = boost::hof::_ ^ boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_xor_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_xor_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_xor_(2, 1) == x_xor_);
- const auto x_bit_or = 2 | 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_or = boost::hof::_ | boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_bit_or)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_bit_or)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_bit_or(2, 1) == x_bit_or);
- const auto x_and_ = true && false;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_and_ = boost::hof::_ && boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_and_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_and_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_and_(true, false) == x_and_);
- const auto x_or_ = true;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_or_ = boost::hof::_ || boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_or_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_or_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_or_(true, false) == x_or_);
- }
- BOOST_HOF_TEST_CASE()
- {
- const auto x_add = 2 + 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_add = 2 + boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_add)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_add)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_add(1) == x_add);
- const auto x_subtract = 2 - 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_subtract = 2 - boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_subtract)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_subtract)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_subtract(1) == x_subtract);
- const auto x_multiply = 2 * 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_multiply = 2 * boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_multiply)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_multiply)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_multiply(1) == x_multiply);
- const auto x_divide = 2 / 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_divide = 2 / boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_divide)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_divide)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_divide(1) == x_divide);
- const auto x_remainder = 2 % 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_remainder = 2 % boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_remainder)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_remainder)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_remainder(1) == x_remainder);
- const auto x_shift_right = 2 >> 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_right = 2 >> boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_shift_right)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_shift_right)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_shift_right(1) == x_shift_right);
- const auto x_shift_left = 2 << 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_left = 2 << boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_shift_left)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_shift_left)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_shift_left(1) == x_shift_left);
- const auto x_greater_than = 2 > 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than = 2 > boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_greater_than)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_greater_than)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_greater_than(1) == x_greater_than);
- const auto x_less_than = 2 < 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than = 2 < boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_less_than)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_less_than)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_less_than(1) == x_less_than);
- const auto x_less_than_equal = 2 <= 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than_equal = 2 <= boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_less_than_equal)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_less_than_equal)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_less_than_equal(1) == x_less_than_equal);
- const auto x_greater_than_equal = 2 >= 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than_equal = 2 >= boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_greater_than_equal)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_greater_than_equal)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_greater_than_equal(1) == x_greater_than_equal);
- const auto x_equal = 2 == 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_equal = 2 == boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_equal)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_equal)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_equal(1) == x_equal);
- const auto x_not_equal = 2 != 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_equal = 2 != boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_not_equal)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_not_equal)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_not_equal(1) == x_not_equal);
- const auto x_bit_and = 2 & 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_and = 2 & boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_bit_and)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_bit_and)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_bit_and(1) == x_bit_and);
- const auto x_xor_ = 2 ^ 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_xor_ = 2 ^ boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_xor_)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_xor_)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_xor_(1) == x_xor_);
- const auto x_bit_or = 2 | 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_or = 2 | boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_bit_or)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_bit_or)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_bit_or(1) == x_bit_or);
- const auto x_and_ = true && false;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_and_ = true && boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_and_)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_and_)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_and_(false) == x_and_);
- const auto x_or_ = true;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_or_ = true || boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_or_)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_or_)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_or_(false) == x_or_);
- }
- BOOST_HOF_TEST_CASE()
- {
- const auto x_add = 2 + 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_add = boost::hof::_ + 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_add)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_add)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_add(2) == x_add);
- const auto x_subtract = 2 - 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_subtract = boost::hof::_ - 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_subtract)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_subtract)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_subtract(2) == x_subtract);
- const auto x_multiply = 2 * 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_multiply = boost::hof::_ * 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_multiply)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_multiply)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_multiply(2) == x_multiply);
- const auto x_divide = 2 / 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_divide = boost::hof::_ / 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_divide)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_divide)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_divide(2) == x_divide);
- const auto x_remainder = 2 % 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_remainder = boost::hof::_ % 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_remainder)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_remainder)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_remainder(2) == x_remainder);
- const auto x_shift_right = 2 >> 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_right = boost::hof::_ >> 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_shift_right)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_shift_right)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_shift_right(2) == x_shift_right);
- const auto x_shift_left = 2 << 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_left = boost::hof::_ << 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_shift_left)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_shift_left)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_shift_left(2) == x_shift_left);
- const auto x_greater_than = 2 > 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than = boost::hof::_ > 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_greater_than)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_greater_than)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_greater_than(2) == x_greater_than);
- const auto x_less_than = 2 < 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than = boost::hof::_ < 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_less_than)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_less_than)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_less_than(2) == x_less_than);
- const auto x_less_than_equal = 2 <= 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than_equal = boost::hof::_ <= 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_less_than_equal)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_less_than_equal)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_less_than_equal(2) == x_less_than_equal);
- const auto x_greater_than_equal = 2 >= 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than_equal = boost::hof::_ >= 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_greater_than_equal)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_greater_than_equal)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_greater_than_equal(2) == x_greater_than_equal);
- const auto x_equal = 2 == 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_equal = boost::hof::_ == 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_equal)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_equal)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_equal(2) == x_equal);
- const auto x_not_equal = 2 != 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_equal = boost::hof::_ != 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_not_equal)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_not_equal)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_not_equal(2) == x_not_equal);
- const auto x_bit_and = 2 & 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_and = boost::hof::_ & 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_bit_and)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_bit_and)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_bit_and(2) == x_bit_and);
- const auto x_xor_ = 2 ^ 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_xor_ = boost::hof::_ ^ 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_xor_)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_xor_)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_xor_(2) == x_xor_);
- const auto x_bit_or = 2 | 1;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_or = boost::hof::_ | 1;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_bit_or)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_bit_or)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_bit_or(2) == x_bit_or);
- const auto x_and_ = true && false;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_and_ = boost::hof::_ && false;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_and_)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_and_)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_and_(true) == x_and_);
- const auto x_or_ = true;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_or_ = boost::hof::_ || false;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_or_)>::value, "Not copyable");
- #endif
- static_assert(!boost::hof::detail::is_default_constructible<decltype(f_or_)>::value, "default constructible");
- PLACEHOLDER_CHECK(f_or_(true) == x_or_);
- }
- BOOST_HOF_TEST_CASE()
- {
- const auto x_not_ = !false;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_ = !boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_not_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_not_(false) == x_not_);
- const auto x_compl_ = ~2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_compl_ = ~boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_compl_)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_compl_)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_compl_(2) == x_compl_);
- const auto x_unary_plus = +2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_unary_plus = +boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_unary_plus)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_unary_plus)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_unary_plus(2) == x_unary_plus);
- const auto x_unary_subtract = -2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_unary_subtract = -boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_unary_subtract)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_unary_subtract)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_unary_subtract(2) == x_unary_subtract);
- const auto x_dereference = 2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_dereference = *boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_dereference)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_dereference)>::value, "Not default constructible");
- PLACEHOLDER_CHECK(f_dereference(&x_dereference) == x_dereference);
- // TODO: Test constexpr increment and decrement
- #ifndef _MSC_VER
- auto x_increment = 2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_increment = ++boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_increment)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_increment)>::value, "Not default constructible");
- f_increment(x_increment);
- BOOST_HOF_TEST_CHECK(x_increment == 3);
- auto x_decrement = 2;
- BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_decrement = --boost::hof::_;
- #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
- static_assert(std::is_copy_constructible<decltype(f_decrement)>::value, "Not copyable");
- #endif
- static_assert(boost::hof::detail::is_default_constructible<decltype(f_decrement)>::value, "Not default constructible");
- f_decrement(x_decrement);
- BOOST_HOF_TEST_CHECK(x_decrement == 1);
- #endif
- // TODO: Test post increment and decrement
- }
|