Skip to content

fixed all C++ warnings #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accumulate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class iter::impl::Accumulator {
sub_end_{std::move(sub_end)},
accumulate_func_(&accumulate_fun),
// only get first value if not an end iterator
acc_val_{!(sub_iter_ != sub_end_)
acc_val_{(sub_iter_ == sub_end_)
? std::nullopt
: std::make_optional<AccumVal>(*sub_iter_)} {}

Expand Down
2 changes: 1 addition & 1 deletion batched.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class iter::impl::Batcher {
template <typename T>
bool operator==(const Iterator<T>& other) const {
return done() == other.done()
&& (done() || !(sub_iter_ != other.sub_iter_));
&& (done() || (sub_iter_ == other.sub_iter_));
}

DerefVec<ContainerT>& operator*() {
Expand Down
2 changes: 1 addition & 1 deletion chunked.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class iter::impl::Chunker {
template <typename T>
bool operator==(const Iterator<T>& other) const {
return done() == other.done()
&& (done() || !(sub_iter_ != other.sub_iter_));
&& (done() || (sub_iter_ == other.sub_iter_));
}

DerefVec<ContainerT>& operator*() {
Expand Down
2 changes: 1 addition & 1 deletion cycle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class iter::impl::Cycler {
Iterator& operator++() {
++sub_iter_;
// reset to beginning upon reaching the sub_end_
if (!(sub_iter_ != sub_end_)) {
if ((sub_iter_ == sub_end_)) {
sub_iter_ = sub_begin_;
}
return *this;
Expand Down
2 changes: 1 addition & 1 deletion groupby.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class iter::impl::GroupProducer {
}

bool exhausted() const {
return !(sub_iter_ != sub_end_);
return (sub_iter_ == sub_end_);
}

typename Holder<ContainerT>::reference get() {
Expand Down
11 changes: 5 additions & 6 deletions test/test_iteratoriterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,25 @@ TEST_CASE("IteratorIterator supports mutable RandomAccessIterator operators",
REQUIRE(&(*r2++) == &a[1]);
REQUIRE(r == r2);
auto test_const_or_not = [&itr](auto& a, auto& b) {
REQUIRE(!(b == a));
REQUIRE((b != a));
REQUIRE(b == a + 2);
REQUIRE(b == 2 + a);
REQUIRE(b - 2 == a);
REQUIRE(&a[2] == &b[0]);
REQUIRE(b - a == 2);
REQUIRE(a < b);
REQUIRE(!(a < a));
REQUIRE((a >= a));
REQUIRE(b > a);
REQUIRE(!(a > a));
REQUIRE((a = a));
REQUIRE(a <= b);
REQUIRE(!(b <= a));
REQUIRE((b > a));
REQUIRE(a <= a);
REQUIRE(b >= a);
REQUIRE(!(a >= b));
REQUIRE((a < b));
REQUIRE(a >= a);

// InputIterator:
REQUIRE(b != a);
REQUIRE(!(a != a));
REQUIRE(&(*a) != &(*b));
REQUIRE(&(a->value) == &(*a).value);

Expand Down