Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
squash: call inc operator for decr operator
  • Loading branch information
danbev committed Mar 9, 2018
commit 5c687c07789fcc66faca8e41d27f665a66ad9e32
8 changes: 1 addition & 7 deletions src/aliased_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,7 @@ class AliasedBuffer {

template <typename T>
inline Reference& operator-=(const T& val) {
const T current = aliased_buffer_->GetValue(index_);
aliased_buffer_->SetValue(index_, current - val);
return *this;
}

inline Reference& operator-=(const Reference& val) {
return *this->operator-=(static_cast<NativeT>(val));
return this->operator+=(-val);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure, this still works if val is a reference?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would definitely be good to test for that.

}

private:
Expand Down