From d5783db61de4e428043d4be06256de2d84cd9cd6 Mon Sep 17 00:00:00 2001 From: Steven Hahn <hahnse@ornl.gov> Date: Tue, 12 Jul 2016 06:39:15 -0400 Subject: [PATCH] Apply changes suggested by modernize-use-emplace --- Framework/API/src/Expression.cpp | 4 +-- .../Algorithms/src/EQSANSTofStructure.cpp | 2 +- Framework/Algorithms/src/FilterByLogValue.cpp | 2 +- .../Algorithms/src/FindPeakBackground.cpp | 4 +-- Framework/Algorithms/src/GetAllEi.cpp | 2 +- Framework/Algorithms/src/SmoothNeighbours.cpp | 6 ++--- .../src/ConnectedComponentLabeling.cpp | 2 +- .../Crystal/src/IntegratePeakTimeSlices.cpp | 16 +++++------ .../Crystal/src/OptimizeCrystalPlacement.cpp | 3 +-- .../DataHandling/src/LoadEventPreNexus.cpp | 5 ++-- Framework/DataHandling/src/LoadSassena.cpp | 2 +- .../DataObjects/inc/MantidDataObjects/MDBox.h | 7 +++-- .../inc/MantidDataObjects/MDEvent.h | 6 ++--- .../inc/MantidDataObjects/MDLeanEvent.h | 4 +-- .../inc/MantidDataObjects/TableColumn.h | 2 +- Framework/DataObjects/src/EventList.cpp | 27 ++++++++----------- Framework/Geometry/src/Objects/Object.cpp | 12 ++++----- Framework/Kernel/src/TimeSeriesProperty.cpp | 16 +++++------ Framework/Kernel/src/TimeSplitter.cpp | 9 +++---- .../TestHelpers/src/MDEventsTestHelper.cpp | 4 +-- 20 files changed, 61 insertions(+), 74 deletions(-) diff --git a/Framework/API/src/Expression.cpp b/Framework/API/src/Expression.cpp index c9d2eb82650..a2e09fd7d77 100644 --- a/Framework/API/src/Expression.cpp +++ b/Framework/API/src/Expression.cpp @@ -311,7 +311,7 @@ void Expression::tokenize() { if (!tokens.empty()) { // remove operators of higher prec - m_tokens.push_back(Token(tokens[0])); + m_tokens.emplace_back(tokens[0]); for (size_t i = 0; i < tokens.size(); i++) { Token &tok = tokens[i]; std::string op = m_expr.substr(tok.ie + 1, tok.is1 - tok.ie - 1); //? @@ -320,7 +320,7 @@ void Expression::tokenize() { last_tok.ie = tok.ie; last_tok.is1 = tok.is1; if (i != tokens.size() - 1) - m_tokens.push_back(Token(tokens[i + 1])); + m_tokens.emplace_back(tokens[i + 1]); } } } diff --git a/Framework/Algorithms/src/EQSANSTofStructure.cpp b/Framework/Algorithms/src/EQSANSTofStructure.cpp index 71844e0682a..83bb0bf2f21 100644 --- a/Framework/Algorithms/src/EQSANSTofStructure.cpp +++ b/Framework/Algorithms/src/EQSANSTofStructure.cpp @@ -182,7 +182,7 @@ void EQSANSTofStructure::execEvent( // At this point the events in the second frame are still off by a frame if (frame_skipping && rel_tof > tof_frame_width) newtof += tof_frame_width; - clean_events.push_back(TofEvent(newtof, it->pulseTime())); + clean_events.emplace_back(newtof, it->pulseTime()); } events.clear(); events.reserve(clean_events.size()); diff --git a/Framework/Algorithms/src/FilterByLogValue.cpp b/Framework/Algorithms/src/FilterByLogValue.cpp index ba5bc4ccb20..8d0c0766ee4 100644 --- a/Framework/Algorithms/src/FilterByLogValue.cpp +++ b/Framework/Algorithms/src/FilterByLogValue.cpp @@ -153,7 +153,7 @@ void FilterByLogValue::exec() { splitter.push_back(interval); } // And the last one - splitter.push_back(SplittingInterval(lastTime, run_stop, 0)); + splitter.emplace_back(lastTime, run_stop, 0); } else { // ----- Filter by value ------ diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp index ae41cc5a6c3..e9421acf494 100644 --- a/Framework/Algorithms/src/FindPeakBackground.cpp +++ b/Framework/Algorithms/src/FindPeakBackground.cpp @@ -176,12 +176,12 @@ void FindPeakBackground::exec() { // for loop can start > 1 for multiple peaks vector<cont_peak> peaks; if (mask[0] == 1) { - peaks.push_back(cont_peak()); + peaks.emplace_back(); peaks.back().start = l0; } for (size_t l = 1; l < n - l0; ++l) { if (mask[l] != mask[l - 1] && mask[l] == 1) { - peaks.push_back(cont_peak()); + peaks.emplace_back(); peaks.back().start = l + l0; } else if (!peaks.empty()) { size_t ipeak = peaks.size() - 1; diff --git a/Framework/Algorithms/src/GetAllEi.cpp b/Framework/Algorithms/src/GetAllEi.cpp index 1eb440656c4..894da3e4857 100644 --- a/Framework/Algorithms/src/GetAllEi.cpp +++ b/Framework/Algorithms/src/GetAllEi.cpp @@ -340,7 +340,7 @@ void GetAllEi::exec() { bool found = findMonitorPeak(monitorWS, guess_ei[i], monsRangeMin, monsRangeMax, energy, height, twoSigma); if (found) { - peaks.push_back(peakKeeper(energy, height, 0.5 * twoSigma)); + peaks.emplace_back(energy, height, 0.5 * twoSigma); if (peaks.back().energy > maxPeakEnergy) maxPeakEnergy = peaks.back().energy; } diff --git a/Framework/Algorithms/src/SmoothNeighbours.cpp b/Framework/Algorithms/src/SmoothNeighbours.cpp index 7feaf25ca85..7b077c97c79 100644 --- a/Framework/Algorithms/src/SmoothNeighbours.cpp +++ b/Framework/Algorithms/src/SmoothNeighbours.cpp @@ -250,7 +250,7 @@ void SmoothNeighbours::findNeighboursRectangular() { // Build a map to sort by the detectorID std::vector<std::pair<int, int>> v1; for (int i = 0; i < static_cast<int>(detList.size()); i++) - v1.push_back(std::pair<int, int>(detList[i]->getAtXY(0, 0)->getID(), i)); + v1.emplace_back(detList[i]->getAtXY(0, 0)->getID(), i); // To sort in descending order if (sum) @@ -287,7 +287,7 @@ void SmoothNeighbours::findNeighboursRectangular() { auto mapEntry = pixel_to_wi.find(pixelID); if (mapEntry != pixel_to_wi.end()) { size_t wi = mapEntry->second; - neighbours.push_back(weightedNeighbour(wi, smweight)); + neighbours.emplace_back(wi, smweight); // Count the total weight totalWeight += smweight; } @@ -421,7 +421,7 @@ void SmoothNeighbours::findNeighboursUbiqutious() { noNeigh++; used[neighWI] = true; } - neighbours.push_back(weightedNeighbour(neighWI, weight)); + neighbours.emplace_back(neighWI, weight); totalWeight += weight; } } diff --git a/Framework/Crystal/src/ConnectedComponentLabeling.cpp b/Framework/Crystal/src/ConnectedComponentLabeling.cpp index 92394ec1385..920b852f6ff 100644 --- a/Framework/Crystal/src/ConnectedComponentLabeling.cpp +++ b/Framework/Crystal/src/ConnectedComponentLabeling.cpp @@ -143,7 +143,7 @@ size_t doConnectedComponentLabeling(IMDIterator *iterator, correcly provided for all neighbours until the end. We must store indexes instead. */ - edgeIndexVec.push_back(EdgeIndexPair(currentIndex, neighIndex)); + edgeIndexVec.emplace_back(currentIndex, neighIndex); continue; } diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp index d5e79b24f6d..0c36558a43b 100644 --- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp +++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp @@ -1944,11 +1944,11 @@ DataModeHandler::CalcConstraints(std::vector<std::pair<double, double>> &Bounds, double min = max<double>(0.0, back_calc - NSigs * (1 + relError) * sqrt(backVar)); double maxx = back + NSigs * (1.8 + relError) * sqrt(backVar); - Bounds.push_back(pair<double, double>(min, maxx)); - Bounds.push_back(pair<double, double>( + Bounds.emplace_back(min, maxx); + Bounds.emplace_back( max<double>(0.0, Intensity_calc - NSigs * (1 + relError) * sqrt(IntensVar)), - Intensity_calc + NSigs * (1 + relError) * sqrt(IntensVar))); + Intensity_calc + NSigs * (1 + relError) * sqrt(IntensVar)); double relErr1 = relError * .75; double val = col_calc; double minn = std::max<double>(MinCol - .5, (1 - relErr1) * val); @@ -1957,7 +1957,7 @@ DataModeHandler::CalcConstraints(std::vector<std::pair<double, double>> &Bounds, str << "," << minn << "<" << "Mcol" << "<" << maxx; - Bounds.push_back(pair<double, double>(minn, maxx)); + Bounds.emplace_back(minn, maxx); val = row_calc; @@ -1966,7 +1966,7 @@ DataModeHandler::CalcConstraints(std::vector<std::pair<double, double>> &Bounds, str << "," << minn << "<" << "Mrow" << "<" << maxx; - Bounds.push_back(pair<double, double>(minn, maxx)); + Bounds.emplace_back(minn, maxx); if (N >= 5) { val = Vx_calc; @@ -1981,8 +1981,7 @@ DataModeHandler::CalcConstraints(std::vector<std::pair<double, double>> &Bounds, str << "," << (1 - relErr1) * valmin << "<" << "SScol" << "<" << (1 + relErr1) * valmax; - Bounds.push_back( - pair<double, double>((1 - relErr1) * valmin, (1 + relErr1) * valmax)); + Bounds.emplace_back((1 - relErr1) * valmin, (1 + relErr1) * valmax); val = Vy_calc; valmin = val; @@ -1994,8 +1993,7 @@ DataModeHandler::CalcConstraints(std::vector<std::pair<double, double>> &Bounds, str << "," << (1 - relErr1) * valmin << "<" << "SSrow" << "<" << (1 + relErr1) * valmax; - Bounds.push_back( - pair<double, double>((1 - relErr1) * valmin, (1 + relErr1) * valmax)); + Bounds.emplace_back((1 - relErr1) * valmin, (1 + relErr1) * valmax); } return str.str(); diff --git a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp index ffad1de8dfc..3a3d5a9d36f 100644 --- a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp +++ b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp @@ -190,8 +190,7 @@ void OptimizeCrystalPlacement::exec() { Geometry::Goniometer Gon(peak.getGoniometerMatrix()); std::vector<double> phichiOmega = Gon.getEulerAngles("YZY"); - ChiPhiOmega.push_back( - V3D(phichiOmega[1], phichiOmega[2], phichiOmega[0])); + ChiPhiOmega.emplace_back(phichiOmega[1], phichiOmega[2], phichiOmega[0]); } if (use) // add to lists for workspace diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp index 601c0c149c5..83c5f156bbe 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -933,9 +933,8 @@ void LoadEventPreNexus::readPulseidFile(const std::string &filename, if (num_pulses > 0) { this->pulsetimes.reserve(num_pulses); for (const auto &pulse : pulses) { - this->pulsetimes.push_back( - DateAndTime(static_cast<int64_t>(pulse.seconds), - static_cast<int64_t>(pulse.nanoseconds))); + this->pulsetimes.emplace_back(static_cast<int64_t>(pulse.seconds), + static_cast<int64_t>(pulse.nanoseconds)); this->event_indices.push_back(pulse.event_index); temp = pulse.pCurrent; diff --git a/Framework/DataHandling/src/LoadSassena.cpp b/Framework/DataHandling/src/LoadSassena.cpp index 8bbb51bc042..785472d7a10 100644 --- a/Framework/DataHandling/src/LoadSassena.cpp +++ b/Framework/DataHandling/src/LoadSassena.cpp @@ -137,7 +137,7 @@ MantidVec LoadSassena::loadQvectors(const hid_t &h5file, if (getProperty("SortByQVectors")) { std::vector<mypair> qvmodpair; for (int iq = 0; iq < nq; iq++) - qvmodpair.push_back(mypair(qvmod[iq], iq)); + qvmodpair.emplace_back(qvmod[iq], iq); std::sort(qvmodpair.begin(), qvmodpair.end(), compare); for (int iq = 0; iq < nq; iq++) sorting_indexes.push_back(qvmodpair[iq].second); diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBox.h b/Framework/DataObjects/inc/MantidDataObjects/MDBox.h index 2f6e83de79a..fcf58a8f83d 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDBox.h +++ b/Framework/DataObjects/inc/MantidDataObjects/MDBox.h @@ -247,8 +247,8 @@ public: const std::vector<coord_t> &Coord, const std::vector<uint16_t> &runIndex, const std::vector<uint32_t> &detectorId, size_t nEvents) { for (size_t i = 0; i < nEvents; i++) { - data.push_back(MDE(sigErrSq[2 * i], sigErrSq[2 * i + 1], runIndex[i], - detectorId[i], &Coord[i * nd])); + data.emplace_back(sigErrSq[2 * i], sigErrSq[2 * i + 1], runIndex[i], + detectorId[i], &Coord[i * nd]); } } // create single generic event from event's data @@ -269,8 +269,7 @@ public: const std::vector<uint32_t> & /*detectorId*/, size_t nEvents) { for (size_t i = 0; i < nEvents; i++) { - data.push_back(MDLeanEvent<nd>(sigErrSq[2 * i], sigErrSq[2 * i + 1], - &Coord[i * nd])); + data.emplace_back(sigErrSq[2 * i], sigErrSq[2 * i + 1], &Coord[i * nd]); } } // create single lean event from event's data diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDEvent.h b/Framework/DataObjects/inc/MantidDataObjects/MDEvent.h index e9ef368044c..dfcc1fe1ef4 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDEvent.h +++ b/Framework/DataObjects/inc/MantidDataObjects/MDEvent.h @@ -247,9 +247,9 @@ public: coord_t const *const centers = &(data[ii + 4]); // Create the event with signal, error squared, and the centers - events.push_back(MDEvent<nd>(signal_t(data[ii]), signal_t(data[ii + 1]), - uint16_t(data[ii + 2]), - int32_t(data[ii + 3]), centers)); + events.emplace_back(signal_t(data[ii]), signal_t(data[ii + 1]), + uint16_t(data[ii + 2]), int32_t(data[ii + 3]), + centers); } } }; diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDLeanEvent.h b/Framework/DataObjects/inc/MantidDataObjects/MDLeanEvent.h index f91764777ef..367fad581d2 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDLeanEvent.h +++ b/Framework/DataObjects/inc/MantidDataObjects/MDLeanEvent.h @@ -297,8 +297,8 @@ public: const coord_t *centers = &(coord[ii + 2]); // Create the event with signal, error squared, and the centers - events.push_back(MDLeanEvent<nd>(signal_t(coord[ii]), - signal_t(coord[ii + 1]), centers)); + events.emplace_back(signal_t(coord[ii]), signal_t(coord[ii + 1]), + centers); } } }; diff --git a/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h b/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h index edefcc18e47..d0d16857279 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h +++ b/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h @@ -216,7 +216,7 @@ protected: if (index < m_data.size()) m_data.insert(m_data.begin() + index, Type()); else - m_data.push_back(Type()); + m_data.emplace_back(); } /// Removes an item at index. void remove(size_t index) override { m_data.erase(m_data.begin() + index); } diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index 022f63c5d09..8c2062689b0 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -249,8 +249,7 @@ void EventList::createFromHistogram(const ISpectrum *inSpec, bool GenerateZeros, double tof = X[i] + tofStep * (0.5 + double(j)); // Create and add the event // TODO: try emplace_back() here. - weightedEventsNoTime.push_back( - WeightedEventNoTime(tof, weight, errorSquared)); + weightedEventsNoTime.emplace_back(tof, weight, errorSquared); } } else { // --------- Single event per bin ---------- @@ -260,8 +259,7 @@ void EventList::createFromHistogram(const ISpectrum *inSpec, bool GenerateZeros, double errorSquared = E[i]; errorSquared *= errorSquared; // Create and add the event - weightedEventsNoTime.push_back( - WeightedEventNoTime(tof, weight, errorSquared)); + weightedEventsNoTime.emplace_back(tof, weight, errorSquared); } } // error is nont NAN or infinite } // weight is non-zero, not NAN, and non-infinite @@ -308,11 +306,11 @@ EventList &EventList::operator+=(const TofEvent &event) { break; case WEIGHTED: - this->weightedEvents.push_back(WeightedEvent(event)); + this->weightedEvents.emplace_back(event); break; case WEIGHTED_NOTIME: - this->weightedEventsNoTime.push_back(WeightedEventNoTime(event)); + this->weightedEventsNoTime.emplace_back(event); break; } @@ -692,7 +690,7 @@ void EventList::switchToWeightedEvents() { std::vector<TofEvent>::const_iterator it_end = events.end(); // Cache for speed for (it = events.begin(); it != it_end; ++it) - this->weightedEvents.push_back(WeightedEvent(*it)); + this->weightedEvents.emplace_back(*it); // Get rid of the old events events.clear(); eventType = WEIGHTED; @@ -717,7 +715,7 @@ void EventList::switchToWeightedEventsNoTime() { std::vector<TofEvent>::const_iterator it_end = events.end(); // Cache for speed for (it = events.begin(); it != it_end; ++it) - this->weightedEventsNoTime.push_back(WeightedEventNoTime(*it)); + this->weightedEventsNoTime.emplace_back(*it); // Get rid of the old events events.clear(); weightedEvents.clear(); @@ -731,7 +729,7 @@ void EventList::switchToWeightedEventsNoTime() { std::vector<WeightedEvent>::const_iterator it_end = weightedEvents.end(); // Cache for speed for (it = weightedEvents.begin(); it != it_end; ++it) - this->weightedEventsNoTime.push_back(WeightedEventNoTime(*it)); + this->weightedEventsNoTime.emplace_back(*it); // Get rid of the old events events.clear(); weightedEvents.clear(); @@ -1676,8 +1674,7 @@ EventList::compressEventsHelper(const std::vector<T> &events, if (num > 0) { // Create a new event with the average TOF and summed weights and // squared errors. - out.push_back( - WeightedEventNoTime(totalTof / num, weight, errorSquared)); + out.emplace_back(totalTof / num, weight, errorSquared); } // Start a new combined object num = 1; @@ -1692,7 +1689,7 @@ EventList::compressEventsHelper(const std::vector<T> &events, if (num > 0) { // Create a new event with the average TOF and summed weights and squared // errors. - out.push_back(WeightedEventNoTime(totalTof / num, weight, errorSquared)); + out.emplace_back(totalTof / num, weight, errorSquared); } // If you have over-allocated by more than 5%, reduce the size. @@ -1761,8 +1758,7 @@ void EventList::compressEventsParallelHelper( if (num > 0) { // Create a new event with the average TOF and summed weights and // squared errors. - localOut.push_back( - WeightedEventNoTime(totalTof / num, weight, errorSquared)); + localOut.emplace_back(totalTof / num, weight, errorSquared); } // Start a new combined object num = 1; @@ -1777,8 +1773,7 @@ void EventList::compressEventsParallelHelper( if (num > 0) { // Create a new event with the average TOF and summed weights and squared // errors. - localOut.push_back( - WeightedEventNoTime(totalTof / num, weight, errorSquared)); + localOut.emplace_back(totalTof / num, weight, errorSquared); } } diff --git a/Framework/Geometry/src/Objects/Object.cpp b/Framework/Geometry/src/Objects/Object.cpp index 2fb881e7aae..5e57cd6be77 100644 --- a/Framework/Geometry/src/Objects/Object.cpp +++ b/Framework/Geometry/src/Objects/Object.cpp @@ -1835,12 +1835,12 @@ int Object::searchForObject(Kernel::V3D &point) const { return 1; std::vector<Kernel::V3D> axes; axes.reserve(6); - axes.push_back(Kernel::V3D(1, 0, 0)); - axes.push_back(Kernel::V3D(-1, 0, 0)); - axes.push_back(Kernel::V3D(0, 1, 0)); - axes.push_back(Kernel::V3D(0, -1, 0)); - axes.push_back(Kernel::V3D(0, 0, 1)); - axes.push_back(Kernel::V3D(0, 0, -1)); + axes.emplace_back(1, 0, 0); + axes.emplace_back(-1, 0, 0); + axes.emplace_back(0, 1, 0); + axes.emplace_back(0, -1, 0); + axes.emplace_back(0, 0, 1); + axes.emplace_back(0, 0, -1); std::vector<Kernel::V3D>::const_iterator dir; for (dir = axes.begin(); dir != axes.end(); ++dir) { Geometry::Track tr(point, (*dir)); diff --git a/Framework/Kernel/src/TimeSeriesProperty.cpp b/Framework/Kernel/src/TimeSeriesProperty.cpp index c1230ca8821..7e2c043ee4d 100644 --- a/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -370,12 +370,10 @@ void TimeSeriesProperty<TYPE>::filterByTimes( TimeValueUnit<TYPE> temp(t_start, m_values[tstartindex].value()); mp_copy.push_back(temp); } else { - mp_copy.push_back( - TimeValueUnit<TYPE>(t_start, m_values[tstartindex].value())); + mp_copy.emplace_back(t_start, m_values[tstartindex].value()); for (size_t im = size_t(tstartindex + 1); im <= size_t(tstopindex); ++im) { - mp_copy.push_back( - TimeValueUnit<TYPE>(m_values[im].time(), m_values[im].value())); + mp_copy.emplace_back(m_values[im].time(), m_values[im].value()); } } } // ENDFOR @@ -621,7 +619,7 @@ void TimeSeriesProperty<TYPE>::makeFilterByValue( // boundaries are centred. // Otherwise, use the first 'bad' time. stop = centre ? lastTime + tol : t; - split.push_back(SplittingInterval(start, stop, 0)); + split.emplace_back(start, stop, 0); // Reset the number of good ones, for next time numgood = 0; } @@ -633,7 +631,7 @@ void TimeSeriesProperty<TYPE>::makeFilterByValue( // The log ended on "good" so we need to close it using the last time we // found stop = t + tol; - split.push_back(SplittingInterval(start, stop, 0)); + split.emplace_back(start, stop, 0); } return; @@ -686,7 +684,7 @@ void TimeSeriesProperty<TYPE>::expandFilterToRange( double val = firstValue(); if ((val >= min) && (val <= max)) { TimeSplitterType extraFilter; - extraFilter.push_back(SplittingInterval(range.begin(), firstTime(), 0)); + extraFilter.emplace_back(range.begin(), firstTime(), 0); // Include everything from the start of the run to the first time measured // (which may be a null time interval; this'll be ignored) split = split | extraFilter; @@ -696,7 +694,7 @@ void TimeSeriesProperty<TYPE>::expandFilterToRange( val = lastValue(); if ((val >= min) && (val <= max)) { TimeSplitterType extraFilter; - extraFilter.push_back(SplittingInterval(lastTime(), range.end(), 0)); + extraFilter.emplace_back(lastTime(), range.end(), 0); // Include everything from the start of the run to the first time measured // (which may be a null time interval; this'll be ignored) split = split | extraFilter; @@ -777,7 +775,7 @@ double TimeSeriesProperty<TYPE>::timeAverageValue() const { double retVal = 0.0; try { TimeSplitterType filter; - filter.push_back(SplittingInterval(this->firstTime(), this->lastTime())); + filter.emplace_back(this->firstTime(), this->lastTime()); retVal = this->averageValueInFilter(filter); } catch (std::exception &) { // just return nan diff --git a/Framework/Kernel/src/TimeSplitter.cpp b/Framework/Kernel/src/TimeSplitter.cpp index 2a3f0068b8c..fe2e2fc9039 100644 --- a/Framework/Kernel/src/TimeSplitter.cpp +++ b/Framework/Kernel/src/TimeSplitter.cpp @@ -186,7 +186,7 @@ TimeSplitterType removeFilterOverlap(const TimeSplitterType &a) { ++it; } // We've reached a gap point. Output this merged interval and move on. - out.push_back(SplittingInterval(start, stop, 0)); + out.emplace_back(start, stop, 0); } return out; @@ -242,8 +242,7 @@ TimeSplitterType operator~(const TimeSplitterType &a) { // No entries: then make a "filter" that keeps everything if ((temp.empty())) { - out.push_back( - SplittingInterval(DateAndTime::minimum(), DateAndTime::maximum(), 0)); + out.emplace_back(DateAndTime::minimum(), DateAndTime::maximum(), 0); return out; } @@ -251,7 +250,7 @@ TimeSplitterType operator~(const TimeSplitterType &a) { ait = temp.begin(); if (ait != temp.end()) { // First entry; start at -infinite time - out.push_back(SplittingInterval(DateAndTime::minimum(), ait->start(), 0)); + out.emplace_back(DateAndTime::minimum(), ait->start(), 0); // Now start at the second entry while (ait != temp.end()) { DateAndTime start, stop; @@ -262,7 +261,7 @@ TimeSplitterType operator~(const TimeSplitterType &a) { } else { // Stop at the start of the next entry stop = ait->start(); } - out.push_back(SplittingInterval(start, stop, 0)); + out.emplace_back(start, stop, 0); } } return out; diff --git a/Framework/TestHelpers/src/MDEventsTestHelper.cpp b/Framework/TestHelpers/src/MDEventsTestHelper.cpp index c899f51bb86..3e854c5f5f1 100644 --- a/Framework/TestHelpers/src/MDEventsTestHelper.cpp +++ b/Framework/TestHelpers/src/MDEventsTestHelper.cpp @@ -194,8 +194,8 @@ MDBox<MDLeanEvent<3>, 3> *makeMDBox3() { std::vector<MDLeanEvent<1>> makeMDEvents1(size_t num) { std::vector<MDLeanEvent<1>> out; for (std::size_t i = 0; i < num; i++) { - double coords[1] = {static_cast<double>(i) * 1.0 + 0.5}; - out.push_back(MDLeanEvent<1>(1.0, 1.0, coords)); + double coords[1] = {static_cast<double>(i) + 0.5}; + out.emplace_back(1.0, 1.0, coords); } return out; } -- GitLab