This repository was archived by the owner on Oct 15, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,13 +127,11 @@ class AliasedBuffer {
127127 index_(that.index_) {
128128 }
129129
130- template <typename T>
131- inline Reference& operator =(const T& val) {
130+ inline Reference& operator =(const NativeT& val) {
132131 aliased_buffer_->SetValue (index_, val);
133132 return *this ;
134133 }
135134
136- // This is not caught by the template operator= above.
137135 inline Reference& operator =(const Reference& val) {
138136 return *this = static_cast <NativeT>(val);
139137 }
@@ -142,9 +140,8 @@ class AliasedBuffer {
142140 return aliased_buffer_->GetValue (index_);
143141 }
144142
145- template <typename T>
146- inline Reference& operator +=(const T& val) {
147- const T current = aliased_buffer_->GetValue (index_);
143+ inline Reference& operator +=(const NativeT& val) {
144+ const NativeT current = aliased_buffer_->GetValue (index_);
148145 aliased_buffer_->SetValue (index_, current + val);
149146 return *this ;
150147 }
@@ -153,9 +150,10 @@ class AliasedBuffer {
153150 return this ->operator +=(static_cast <NativeT>(val));
154151 }
155152
156- template <typename T>
157- inline Reference& operator -=(const T& val) {
158- return this ->operator +=(-val);
153+ inline Reference& operator -=(const NativeT& val) {
154+ const NativeT current = aliased_buffer_->GetValue (index_);
155+ aliased_buffer_->SetValue (index_, current - val);
156+ return *this ;
159157 }
160158
161159 private:
You can’t perform that action at this time.
0 commit comments