File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -126,13 +126,11 @@ class AliasedBuffer {
126126 index_(that.index_) {
127127 }
128128
129- template <typename T>
130- inline Reference& operator =(const T& val) {
129+ inline Reference& operator =(const NativeT& val) {
131130 aliased_buffer_->SetValue (index_, val);
132131 return *this ;
133132 }
134133
135- // This is not caught by the template operator= above.
136134 inline Reference& operator =(const Reference& val) {
137135 return *this = static_cast <NativeT>(val);
138136 }
@@ -141,9 +139,8 @@ class AliasedBuffer {
141139 return aliased_buffer_->GetValue (index_);
142140 }
143141
144- template <typename T>
145- inline Reference& operator +=(const T& val) {
146- const T current = aliased_buffer_->GetValue (index_);
142+ inline Reference& operator +=(const NativeT& val) {
143+ const NativeT current = aliased_buffer_->GetValue (index_);
147144 aliased_buffer_->SetValue (index_, current + val);
148145 return *this ;
149146 }
@@ -152,9 +149,10 @@ class AliasedBuffer {
152149 return this ->operator +=(static_cast <NativeT>(val));
153150 }
154151
155- template <typename T>
156- inline Reference& operator -=(const T& val) {
157- return this ->operator +=(-val);
152+ inline Reference& operator -=(const NativeT& val) {
153+ const NativeT current = aliased_buffer_->GetValue (index_);
154+ aliased_buffer_->SetValue (index_, current - val);
155+ return *this ;
158156 }
159157
160158 private:
You can’t perform that action at this time.
0 commit comments