Fix erroneous std::move in indexed set, and clean up addMetric users.

This is a follow-on to c4eb73d0.  Thanks to Bala for pointing out the unchanged
std::move usage, and there appeared to not be many existing users of addMetric
anyway.
This commit is contained in:
Alex Miller 2017-10-11 17:35:10 -07:00
parent c3d8412abb
commit c24b941485
2 changed files with 4 additions and 4 deletions

View File

@ -132,7 +132,7 @@ struct TransientStorageMetricSample : StorageMetricSample {
int64_t delta = queue.front().second.second;
ASSERT( delta != 0 );
if( sample.addMetric( Key(key), delta ) == 0 )
if( sample.addMetric( key, delta ) == 0 )
sample.erase( key );
StorageMetrics deltaM = m * delta;
@ -155,7 +155,7 @@ struct TransientStorageMetricSample : StorageMetricSample {
int64_t delta = queue.front().second.second;
ASSERT( delta != 0 );
if( sample.addMetric( Key(key), delta ) == 0 )
if( sample.addMetric( key, delta ) == 0 )
sample.erase( key );
queue.pop_front();
@ -173,7 +173,7 @@ private:
metric = metric<0 ? -metricUnitsPerSample : metricUnitsPerSample;
}
if( sample.addMetric( Key(key), metric ) == 0 )
if( sample.addMetric( key, metric ) == 0 )
sample.erase( key );
return metric;

View File

@ -611,7 +611,7 @@ typename IndexedSet<T,Metric>::iterator IndexedSet<T,Metric>::insert(T_&& data,
if (!d && !(data < t->data)) { // t->data == data
Node *returnNode = t;
if(replaceExisting) {
t->data = std::move(data);
t->data = std::forward<T_>(data);
Metric delta = t->total;
t->total = metric;
if (t->child[0]) t->total = t->total + t->child[0]->total;