diff --git a/Framework/API/src/Expression.cpp b/Framework/API/src/Expression.cpp index c9d2eb82650e34da6ef1f4308ea321916c338b09..a2e09fd7d77b0441a8b9090fc427b909469f2572 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 71844e0682a2f09cc7066dd92efb03abda09e53b..83bb0bf2f2156c0439de1727efa4bd35e7ed91e4 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 ba5bc4ccb20a1da577f3a95b42a9e929027536e3..8d0c0766ee42b29cd26248e39b900899acd1ed11 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 ae41cc5a6c3294c6df2610287e3dd08084cd91c1..e9421acf494fa471f2d812840491ae4499c37801 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 1eb440656c48e3f2c6e4d50ae9d1ba78899f4839..894da3e4857164458c20c753c1c4fd8d11e52a0b 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 7feaf25ca85ef32e17c506f59d6812906a590dd3..7b077c97c7984d90eaae1e2c336edcee9ae3efe8 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 92394ec1385ecde81a5817b00a69758d96c421ee..920b852f6ff40a16667a14155518ee925957d22f 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 d5e79b24f6daf4538f7320a2aa561772669accde..0c36558a43b97cd84883c1f22b39b687636996a5 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 ffad1de8dfc70b3446f4e7c95671827428c15878..3a3d5a9d36fec23888a4a2526ff0c18c74c0c06f 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 601c0c149c527ab15691dcebdebe1aeca91ca182..83c5f156bbe6dd8e5530d20956bb7c199315b650 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 8bbb51bc0422f3e2f402b37881bf029d15a75c19..785472d7a1053611bc14d117794f021840c0b5d3 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 2f6e83de79a7ec344df8a1421766fc7fc3a6f944..fcf58a8f83d54481c999609b892d26c5e6459538 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 e9ef368044c992424538b51a792aa0dae8b8ca7a..dfcc1fe1ef4be3b1bff5f5ea706b6b19facb5322 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 f91764777ef0501fde68122d84d30d6453594964..367fad581d2bccd03c7a31ba7b7a15e5b0a50ca5 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 edefcc18e475bec3a2617c54e91b5512d5d5ccbb..d0d16857279150e892c2cff27fdab63fcfe638f4 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 022f63c5d098e0b5c1b44669800a16a0f7935c80..8c2062689b0a2ab169ddb37e8d823a6760486e00 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 2fb881e7aae690b768a3dd921104d93917300e11..5e57cd6be77da37a72379370f720b36348ee6dee 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 c1230ca882122dd411b332009ee80c2dd3e6d52d..7e2c043ee4d722e8cc3dace67472bffcb4e06780 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 2a3f0068b8cb4b28a01c62c0254a3474dbf44cb2..fe2e2fc903948eb6614bd5df3501d2e4c58dd5ec 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 c899f51bb86482c4a5a06247ea1e98853c9ac731..3e854c5f5f14022fe2ead725c36e16ad12ecf4a3 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; }