- auto ld = samples.find(loc);
- local_data_t* data;
- if (ld == samples.end()) {
- xbt_assert(threshold>0 || iters>0,
- "You should provide either a positive amount of iterations to bench, or a positive maximal stderr (or both)");
- data = static_cast<local_data_t*>(xbt_new(local_data_t, 1));
- data->count = 0;
- data->sum = 0.0;
- data->sum_pow2 = 0.0;
- data->iters = iters;
- data->threshold = threshold;
- data->benching = 1; // If we have no data, we need at least one
- data->mean = 0;
- samples[loc] = data;
+ auto insert = samples.emplace(loc, LocalData{
+ threshold, // threshold
+ 0.0, // relstderr
+ 0.0, // mean
+ 0.0, // sum
+ 0.0, // sum_pow2
+ iters, // iters
+ 0, // count
+ true // benching (if we have no data, we need at least one)
+ });
+ LocalData& data = insert.first->second;
+ if (insert.second) {