Skip to content

Commit

Permalink
[libc++][NFC] Simplify tests for bind_front
Browse files Browse the repository at this point in the history
  • Loading branch information
ldionne committed Aug 10, 2021
1 parent 638dcea commit ce96d81
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,6 @@ constexpr bool test() {
{
{
MoveOnlyCallable value(true);
using RetT = decltype(std::bind_front(std::move(value), 1));

static_assert( std::is_move_constructible<RetT>::value);
static_assert(!std::is_copy_constructible<RetT>::value);
static_assert(!std::is_move_assignable<RetT>::value);
static_assert(!std::is_copy_assignable<RetT>::value);

auto ret = std::bind_front(std::move(value), 1);
assert(ret());
assert(ret(1, 2, 3));
Expand All @@ -333,16 +326,15 @@ constexpr bool test() {
assert(!ret());
assert(ret1());
assert(ret1(1, 2, 3));
}
{
CopyCallable value(true);
using RetT = decltype(std::bind_front(value, 1));

using RetT = decltype(ret);
static_assert( std::is_move_constructible<RetT>::value);
static_assert( std::is_copy_constructible<RetT>::value);
static_assert(!std::is_copy_constructible<RetT>::value);
static_assert(!std::is_move_assignable<RetT>::value);
static_assert(!std::is_copy_assignable<RetT>::value);

}
{
CopyCallable value(true);
auto ret = std::bind_front(value, 1);
assert(ret());
assert(ret(1, 2, 3));
Expand All @@ -355,6 +347,12 @@ constexpr bool test() {
assert(!ret());
assert(ret2());
assert(ret2(1, 2, 3));

using RetT = decltype(ret);
static_assert( std::is_move_constructible<RetT>::value);
static_assert( std::is_copy_constructible<RetT>::value);
static_assert(!std::is_move_assignable<RetT>::value);
static_assert(!std::is_copy_assignable<RetT>::value);
}
{
CopyAssignableWrapper value(true);
Expand Down

0 comments on commit ce96d81

Please sign in to comment.