Skip to content

Commit

Permalink
Review comments from STL
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Jul 13, 2020
1 parent aaccfc1 commit dc551d1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
14 changes: 7 additions & 7 deletions tests/std/tests/P0896R4_ranges_alg_remove/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ struct instantiator {
static constexpr void call() {
using ranges::remove, ranges::subrange, ranges::equal, ranges::iterator_t;

size_t comparisonsCounter = 0;
auto projection = [&comparisonsCounter](const P& data) {
++comparisonsCounter;
return data.second;
size_t projectionCounter = 0;
auto projection = [&projectionCounter](const P& val) {
++projectionCounter;
return val.second;
};

{ // Validate iterator + sentinel overload
Expand All @@ -38,10 +38,10 @@ struct instantiator {
assert(result.begin() == next(wrapped_input.begin(), 3));
assert(result.end() == wrapped_input.end());
assert(equal(expected, span{input}.first<3>()));
assert(comparisonsCounter == ranges::size(input));
assert(projectionCounter == ranges::size(input));
}

comparisonsCounter = 0;
projectionCounter = 0;

{ // Validate range overload
P input[5] = {{0, 99}, {1, 47}, {2, 99}, {3, 47}, {4, 99}};
Expand All @@ -52,7 +52,7 @@ struct instantiator {
assert(result.begin() == next(wrapped_input.begin(), 3));
assert(result.end() == wrapped_input.end());
assert(equal(expected, span{input}.first<3>()));
assert(comparisonsCounter == ranges::size(input));
assert(projectionCounter == ranges::size(input));
}
}
};
Expand Down
14 changes: 7 additions & 7 deletions tests/std/tests/P0896R4_ranges_alg_remove_copy/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ struct instantiator {
if constexpr (non_proxy || !is_permissive) {
using ranges::remove_copy, ranges::remove_copy_result, ranges::equal, ranges::iterator_t;

size_t comparisonsCounter = 0;
auto projection = [&comparisonsCounter](const P& data) {
++comparisonsCounter;
return data.second;
size_t projectionCounter = 0;
auto projection = [&projectionCounter](const P& val) {
++projectionCounter;
return val.second;
};

{ // Validate iterator + sentinel overload
Expand All @@ -48,10 +48,10 @@ struct instantiator {
assert(result.in == wrapped_input.end());
assert(result.out.peek() == output + 3);
assert(equal(output, expected));
assert(comparisonsCounter == ranges::size(input));
assert(projectionCounter == ranges::size(input));
}

comparisonsCounter = 0;
projectionCounter = 0;

{ // Validate range overload
P output[3] = {{-1, -1}, {-1, -1}, {-1, -1}};
Expand All @@ -62,7 +62,7 @@ struct instantiator {
assert(result.in == wrapped_input.end());
assert(result.out.peek() == output + 3);
assert(equal(output, expected));
assert(comparisonsCounter == ranges::size(input));
assert(projectionCounter == ranges::size(input));
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions tests/std/tests/P0896R4_ranges_alg_remove_copy_if/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ struct instantiator {
if constexpr (non_proxy || !is_permissive) {
using ranges::remove_copy_if, ranges::remove_copy_if_result, ranges::equal, ranges::iterator_t;

size_t comparisonsCounter = 0;
auto projection = [&comparisonsCounter](const P& data) {
++comparisonsCounter;
return data.second;
size_t projectionCounter = 0;
auto projection = [&projectionCounter](const P& val) {
++projectionCounter;
return val.second;
};

{ // Validate iterator + sentinel overload
Expand All @@ -50,10 +50,10 @@ struct instantiator {
assert(result.in == wrapped_input.end());
assert(result.out.peek() == output + 3);
assert(equal(output, expected));
assert(comparisonsCounter == ranges::size(input));
assert(projectionCounter == ranges::size(input));
}

comparisonsCounter = 0;
projectionCounter = 0;

{ // Validate range overload
P output[3] = {{-1, -1}, {-1, -1}, {-1, -1}};
Expand All @@ -63,7 +63,7 @@ struct instantiator {
assert(result.in == wrapped_input.end());
assert(result.out.peek() == output + 3);
assert(equal(output, expected));
assert(comparisonsCounter == ranges::size(input));
assert(projectionCounter == ranges::size(input));
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions tests/std/tests/P0896R4_ranges_alg_remove_if/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using namespace std;
using P = pair<int, int>;

constexpr auto matches = [](int const val) { return val == 47; };
constexpr auto matches = [](const int val) { return val == 47; };

// Validate dangling story
STATIC_ASSERT(same_as<decltype(ranges::remove_if(borrowed<false>{}, matches)), ranges::dangling>);
Expand All @@ -25,10 +25,10 @@ struct instantiator {
static constexpr void call() {
using ranges::remove_if, ranges::subrange, ranges::equal, ranges::iterator_t;

size_t comparisonsCounter = 0;
auto projection = [&comparisonsCounter](const P& data) {
++comparisonsCounter;
return data.second;
size_t projectionCounter = 0;
auto projection = [&projectionCounter](const P& val) {
++projectionCounter;
return val.second;
};

{ // Validate iterator + sentinel overload
Expand All @@ -40,10 +40,10 @@ struct instantiator {
assert(result.begin() == next(wrapped_input.begin(), 3));
assert(result.end() == wrapped_input.end());
assert(equal(expected, span{input}.first<3>()));
assert(comparisonsCounter == ranges::size(input));
assert(projectionCounter == ranges::size(input));
}

comparisonsCounter = 0;
projectionCounter = 0;

{ // Validate range overload
P input[5] = {{0, 99}, {1, 47}, {2, 99}, {3, 47}, {4, 99}};
Expand All @@ -54,7 +54,7 @@ struct instantiator {
assert(result.begin() == next(wrapped_input.begin(), 3));
assert(result.end() == wrapped_input.end());
assert(equal(expected, span{input}.first<3>()));
assert(comparisonsCounter == ranges::size(input));
assert(projectionCounter == ranges::size(input));
}
}
};
Expand Down

0 comments on commit dc551d1

Please sign in to comment.