From e6e520f8f77a39e9f6e3c551aca3819d1fef1418 Mon Sep 17 00:00:00 2001 From: Steven Hahn <hahnse@ornl.gov> Date: Sat, 28 May 2016 14:00:17 -0400 Subject: [PATCH] Use to_string instead of lexical_cast. --- Framework/API/inc/MantidAPI/ITableWorkspace.h | 3 +- Framework/API/src/AnalysisDataService.cpp | 4 +- Framework/API/src/ExperimentInfo.cpp | 2 +- Framework/API/src/FileFinder.cpp | 2 +- Framework/API/src/GroupingLoader.cpp | 2 +- Framework/API/src/IEventWorkspace.cpp | 2 +- Framework/API/src/IFuncMinimizer.cpp | 3 +- Framework/API/src/IFunction.cpp | 4 +- Framework/API/src/IFunctionMD.cpp | 2 +- Framework/API/src/IPeakFunction.cpp | 2 +- Framework/API/src/ITableWorkspace.cpp | 4 +- Framework/API/src/MatrixWorkspace.cpp | 2 +- Framework/API/src/MultiDomainFunction.cpp | 24 +++--- Framework/API/src/ParameterTie.cpp | 2 +- Framework/API/src/SpectraAxis.cpp | 2 +- .../src/CalculateFlatBackground.cpp | 2 +- .../Algorithms/src/CalculateTransmission.cpp | 13 ++-- .../Algorithms/src/ConvertEmptyToTof.cpp | 4 +- .../src/CreateTransmissionWorkspaceAuto.cpp | 11 ++- Framework/Algorithms/src/GetAllEi.cpp | 29 +++---- Framework/Algorithms/src/GetEi2.cpp | 2 +- .../Algorithms/src/He3TubeEfficiency.cpp | 2 +- .../Algorithms/src/PolarizationCorrection.cpp | 3 +- .../src/ReflectometryReductionOneAuto.cpp | 24 +++--- .../src/SANSCollimationLengthEstimator.cpp | 2 +- Framework/Algorithms/src/SofQWCentre.cpp | 10 +-- Framework/Algorithms/src/Stitch1D.cpp | 9 +-- .../src/GoniometerAnglesFromPhiRotation.cpp | 2 +- .../Crystal/src/IntegratePeakTimeSlices.cpp | 4 +- Framework/Crystal/src/LoadIsawPeaks.cpp | 2 +- .../Crystal/src/OptimizeCrystalPlacement.cpp | 4 +- .../src/OptimizeLatticeForCellType.cpp | 3 +- Framework/Crystal/src/PeakHKLErrors.cpp | 6 +- Framework/Crystal/src/SCDCalibratePanels.cpp | 17 ++--- Framework/Crystal/src/SCDPanelErrors.cpp | 4 +- .../src/StatisticsOfPeaksWorkspace.cpp | 4 +- .../src/Algorithms/ConvertToYSpace.cpp | 5 +- .../src/Algorithms/EstimatePeakErrors.cpp | 2 +- Framework/CurveFitting/src/Algorithms/Fit.cpp | 3 +- .../src/Algorithms/PlotPeakByLogValue.cpp | 7 +- .../src/Algorithms/SplineSmoothing.cpp | 2 +- .../VesuvioCalculateGammaBackground.cpp | 6 +- .../src/Algorithms/VesuvioCalculateMS.cpp | 10 +-- .../src/FuncMinimizers/FABADAMinimizer.cpp | 3 +- .../LevenbergMarquardtMinimizer.cpp | 4 +- .../CurveFitting/src/Functions/BSpline.cpp | 2 +- .../CurveFitting/src/Functions/Chebyshev.cpp | 2 +- .../src/Functions/ComptonProfile.cpp | 2 +- .../src/Functions/CubicSpline.cpp | 8 +- .../src/Functions/FullprofPolynomial.cpp | 4 +- .../CurveFitting/src/Functions/Polynomial.cpp | 2 +- .../src/Functions/ReflectivityMulf.cpp | 6 +- .../src/Functions/VesuvioResolution.cpp | 2 +- .../CurveFitting/src/GeneralDomainCreator.cpp | 4 +- .../CurveFitting/src/IFittingAlgorithm.cpp | 3 +- .../CurveFitting/src/MultiDomainCreator.cpp | 3 +- .../inc/MantidDataHandling/LoadEventNexus.h | 2 +- .../src/CreateSimulationWorkspace.cpp | 2 +- .../DataHandling/src/GroupDetectors2.cpp | 18 ++--- Framework/DataHandling/src/Load.cpp | 7 +- Framework/DataHandling/src/LoadAscii2.cpp | 10 +-- .../DataHandling/src/LoadDetectorInfo.cpp | 3 +- .../src/LoadDetectorsGroupingFile.cpp | 2 +- Framework/DataHandling/src/LoadEventNexus.cpp | 4 +- Framework/DataHandling/src/LoadFITS.cpp | 21 +++-- Framework/DataHandling/src/LoadHelper.cpp | 6 +- .../DataHandling/src/LoadILLIndirect.cpp | 2 +- Framework/DataHandling/src/LoadILLSANS.cpp | 2 +- Framework/DataHandling/src/LoadISISNexus2.cpp | 12 ++- Framework/DataHandling/src/LoadMLZ.cpp | 7 +- Framework/DataHandling/src/LoadMcStas.cpp | 6 +- Framework/DataHandling/src/LoadMuonNexus1.cpp | 2 +- Framework/DataHandling/src/LoadMuonNexus2.cpp | 3 +- .../DataHandling/src/LoadNexusProcessed.cpp | 12 ++- Framework/DataHandling/src/LoadQKK.cpp | 5 +- Framework/DataHandling/src/LoadRKH.cpp | 2 +- Framework/DataHandling/src/LoadRawHelper.cpp | 2 +- .../DataHandling/src/LoadSavuTomoConfig.cpp | 2 +- Framework/DataHandling/src/LoadTBL.cpp | 26 +++---- Framework/DataHandling/src/SaveAscii2.cpp | 2 +- Framework/DataHandling/src/SaveISISNexus.cpp | 3 +- .../DataHandling/src/SaveOpenGenieAscii.cpp | 4 +- .../DataHandling/src/SaveSavuTomoConfig.cpp | 3 +- Framework/DataObjects/src/PeaksWorkspace.cpp | 10 +-- Framework/DataObjects/src/Workspace2D.cpp | 8 +- .../src/Crystal/SymmetryElementFactory.cpp | 4 +- .../src/Instrument/ComponentHelper.cpp | 4 +- .../Instrument/InstrumentDefinitionParser.cpp | 3 +- .../Geometry/src/Instrument/ParameterMap.cpp | 4 +- Framework/ICat/src/ICat3/ICat3Helper.cpp | 8 +- Framework/ICat/src/ICat4/ICat4Catalog.cpp | 17 ++--- Framework/Kernel/src/MultiFileNameParser.cpp | 10 +-- Framework/Kernel/src/PropertyHistory.cpp | 4 +- Framework/Kernel/src/UnitConversion.cpp | 2 +- Framework/LiveData/src/ADARA/ADARAPackets.cpp | 76 +++++++++---------- .../LiveData/src/ISISHistoDataListener.cpp | 12 ++- .../src/ISISLiveEventDataListener.cpp | 2 +- Framework/LiveData/src/LoadLiveData.cpp | 4 +- Framework/MDAlgorithms/src/CompactMD.cpp | 3 +- .../MDAlgorithms/src/ConvertToMDParent.cpp | 5 +- Framework/MDAlgorithms/src/CutMD.cpp | 14 ++-- .../MDAlgorithms/src/MDEventWSWrapper.cpp | 11 ++- Framework/MDAlgorithms/src/MDTransfModQ.cpp | 8 +- Framework/MDAlgorithms/src/MDTransfNoQ.cpp | 8 +- .../MDAlgorithms/src/MDWSDescription.cpp | 39 +++++----- .../Quantification/CachedExperimentInfo.cpp | 2 +- .../src/Quantification/Models/QCoordinate.cpp | 2 +- .../Resolution/TobyFitResolutionModel.cpp | 2 +- Framework/MDAlgorithms/src/UserFunctionMD.cpp | 2 +- Framework/Nexus/src/NexusFileIO.cpp | 2 +- .../api/src/Exports/IMDHistoWorkspace.cpp | 4 +- .../api/src/Exports/ITableWorkspace.cpp | 4 +- .../api/src/Exports/MatrixWorkspace.cpp | 6 +- .../mantid/kernel/src/Exports/VMD.cpp | 14 ++-- .../src/SCARFTomoReconstruction.cpp | 8 +- .../RemoteJobManagers/src/LSFJobManager.cpp | 12 ++- .../src/MantidWebServiceAPIJobManager.cpp | 4 +- .../src/SCARFLSFJobManager.cpp | 4 +- Framework/SINQ/src/PoldiFitPeaks1D2.cpp | 2 +- .../PoldiAutoCorrelationCore.cpp | 7 +- .../PoldiResidualCorrelationCore.cpp | 4 +- .../src/ComponentCreationHelper.cpp | 8 +- .../src/MDAlgorithmsTestHelper.cpp | 4 +- .../src/ConvolutionFitSequential.cpp | 8 +- 124 files changed, 366 insertions(+), 456 deletions(-) diff --git a/Framework/API/inc/MantidAPI/ITableWorkspace.h b/Framework/API/inc/MantidAPI/ITableWorkspace.h index cba5b275a3b..bd587eac8c0 100644 --- a/Framework/API/inc/MantidAPI/ITableWorkspace.h +++ b/Framework/API/inc/MantidAPI/ITableWorkspace.h @@ -232,8 +232,7 @@ public: throw std::runtime_error(ostr.str()); } if (row >= this->rowCount()) { - throw std::range_error("Table does not have row " + - boost::lexical_cast<std::string>(row)); + throw std::range_error("Table does not have row " + std::to_string(row)); } return *(static_cast<T *>(c->void_pointer(row))); } diff --git a/Framework/API/src/AnalysisDataService.cpp b/Framework/API/src/AnalysisDataService.cpp index 44f38d03114..69e8adc2007 100644 --- a/Framework/API/src/AnalysisDataService.cpp +++ b/Framework/API/src/AnalysisDataService.cpp @@ -81,7 +81,7 @@ void AnalysisDataServiceImpl::add( std::string wsName = ws->name(); // if anonymous make up a name and add if (wsName.empty()) { - wsName = name + "_" + boost::lexical_cast<std::string>(i + 1); + wsName = name + "_" + std::to_string(i + 1); } else if (doesExist(wsName)) { // if ws is already there do nothing wsName.clear(); } @@ -120,7 +120,7 @@ void AnalysisDataServiceImpl::addOrReplace( std::string wsName = ws->name(); // make up a name for an anonymous workspace if (wsName.empty()) { - wsName = name + "_" + boost::lexical_cast<std::string>(i + 1); + wsName = name + "_" + std::to_string(i + 1); } else if (doesExist(wsName)) { // if ws is already there do nothing wsName.clear(); } diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp index cf7d1eb9d41..3d84dd8471a 100644 --- a/Framework/API/src/ExperimentInfo.cpp +++ b/Framework/API/src/ExperimentInfo.cpp @@ -345,7 +345,7 @@ ExperimentInfo::getGroupMembers(const detid_t detID) const { } else { throw std::runtime_error( "ExperimentInfo::getGroupMembers - Unable to find ID " + - boost::lexical_cast<std::string>(detID) + " in lookup"); + std::to_string(detID) + " in lookup"); } } diff --git a/Framework/API/src/FileFinder.cpp b/Framework/API/src/FileFinder.cpp index f271ee799f5..5ca6d056e8b 100644 --- a/Framework/API/src/FileFinder.cpp +++ b/Framework/API/src/FileFinder.cpp @@ -643,7 +643,7 @@ FileFinderImpl::findRuns(const std::string &hintstr) const { throw std::invalid_argument("Malformed range of runs: " + *h); } for (int irun = runNumber; irun <= runEndNumber; ++irun) { - run = boost::lexical_cast<std::string>(irun); + run = std::to_string(irun); while (run.size() < nZero) run.insert(0, "0"); std::string path = findRun(p1.first + run); diff --git a/Framework/API/src/GroupingLoader.cpp b/Framework/API/src/GroupingLoader.cpp index d9e39fff747..9b54918ae97 100644 --- a/Framework/API/src/GroupingLoader.cpp +++ b/Framework/API/src/GroupingLoader.cpp @@ -251,7 +251,7 @@ Grouping::Grouping(ITableWorkspace_sptr table) { // Convert to a range string, i.e. 1-5,6-8,9 std::string detectorRange = Kernel::Strings::toString(detectors); - this->groupNames.push_back(boost::lexical_cast<std::string>(row + 1)); + this->groupNames.push_back(std::to_string(row + 1)); this->groups.push_back(detectorRange); } diff --git a/Framework/API/src/IEventWorkspace.cpp b/Framework/API/src/IEventWorkspace.cpp index e802d949a23..14348a11e3b 100644 --- a/Framework/API/src/IEventWorkspace.cpp +++ b/Framework/API/src/IEventWorkspace.cpp @@ -13,7 +13,7 @@ const std::string IEventWorkspace::toString() const { std::ostringstream os; os << MatrixWorkspace::toString() << "\n"; - os << "Events: " + boost::lexical_cast<std::string>(getNumberEvents()); + os << "Events: " + std::to_string(getNumberEvents()); switch (getEventType()) { case WEIGHTED: os << " (weighted)\n"; diff --git a/Framework/API/src/IFuncMinimizer.cpp b/Framework/API/src/IFuncMinimizer.cpp index 10613e4f9d5..3dd39aed917 100644 --- a/Framework/API/src/IFuncMinimizer.cpp +++ b/Framework/API/src/IFuncMinimizer.cpp @@ -33,8 +33,7 @@ bool IFuncMinimizer::minimize(size_t maxIterations) { m_errorString += '\n'; } m_errorString += "Failed to converge after " + - boost::lexical_cast<std::string>(maxIterations) + - " iterations."; + std::to_string(maxIterations) + " iterations."; } return success; diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index 6b25ca79d84..ff97f7a13fe 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -314,9 +314,7 @@ protected: return (m_quoteString) ? std::string("\"" + str + "\"") : str; } /// Apply if int - std::string apply(const int &i) const override { - return boost::lexical_cast<std::string>(i); - } + std::string apply(const int &i) const override { return std::to_string(i); } /// Apply if double std::string apply(const double &d) const override { return boost::lexical_cast<std::string>(d); diff --git a/Framework/API/src/IFunctionMD.cpp b/Framework/API/src/IFunctionMD.cpp index c150d0c36cd..f1160cf4d80 100644 --- a/Framework/API/src/IFunctionMD.cpp +++ b/Framework/API/src/IFunctionMD.cpp @@ -93,7 +93,7 @@ void IFunctionMD::evaluateFunction(const FunctionDomainMD &domain, for (const IMDIterator *r = domain.getNextIterator(); r != nullptr; r = domain.getNextIterator()) { this->reportProgress("Evaluating function for box " + - boost::lexical_cast<std::string>(i + 1)); + std::to_string(i + 1)); values.setCalculated(i, functionMD(*r)); i++; }; diff --git a/Framework/API/src/IPeakFunction.cpp b/Framework/API/src/IPeakFunction.cpp index 734730872d8..6f8aa8fd202 100644 --- a/Framework/API/src/IPeakFunction.cpp +++ b/Framework/API/src/IPeakFunction.cpp @@ -155,7 +155,7 @@ void IPeakFunction::functionDeriv1D(Jacobian *out, const double *xValues, void IPeakFunction::setPeakRadius(const int &r) { if (r > 0) { s_peakRadius = r; - std::string setting = boost::lexical_cast<std::string>(r); + std::string setting = std::to_string(r); Kernel::ConfigService::Instance().setString("curvefitting.peakRadius", setting); } diff --git a/Framework/API/src/ITableWorkspace.cpp b/Framework/API/src/ITableWorkspace.cpp index 979cd97fbf8..0e81324887a 100644 --- a/Framework/API/src/ITableWorkspace.cpp +++ b/Framework/API/src/ITableWorkspace.cpp @@ -16,8 +16,8 @@ ITableWorkspace::clone(const std::vector<std::string> &colNames) const { const std::string ITableWorkspace::toString() const { std::ostringstream os; os << id() << "\n"; - os << "Columns: " << boost::lexical_cast<std::string>(columnCount()) << "\n"; - os << "Rows: " << boost::lexical_cast<std::string>(rowCount()) << "\n"; + os << "Columns: " << std::to_string(columnCount()) << "\n"; + os << "Rows: " << std::to_string(rowCount()) << "\n"; os << getMemorySizeAsStr(); return os.str(); } diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp index 7ea93d38c1f..30bc1bdc513 100644 --- a/Framework/API/src/MatrixWorkspace.cpp +++ b/Framework/API/src/MatrixWorkspace.cpp @@ -1523,7 +1523,7 @@ signal_t MatrixWorkspace::getSignalAtCoord( if (this->axes() != 2) throw std::invalid_argument("MatrixWorkspace::getSignalAtCoord() - " "Workspace can only have 2 axes, found " + - boost::lexical_cast<std::string>(this->axes())); + std::to_string(this->axes())); coord_t x = coords[0]; coord_t y = coords[1]; diff --git a/Framework/API/src/MultiDomainFunction.cpp b/Framework/API/src/MultiDomainFunction.cpp index 15afb0e0ab7..0e06682a226 100644 --- a/Framework/API/src/MultiDomainFunction.cpp +++ b/Framework/API/src/MultiDomainFunction.cpp @@ -104,11 +104,10 @@ void MultiDomainFunction::function(const FunctionDomain &domain, const CompositeDomain &cd = dynamic_cast<const CompositeDomain &>(domain); // domain must not have less parts than m_maxIndex if (cd.getNParts() <= m_maxIndex) { - throw std::invalid_argument( - "CompositeDomain has too few parts (" + - boost::lexical_cast<std::string>(cd.getNParts()) + - ") for MultiDomainFunction (max index " + - boost::lexical_cast<std::string>(m_maxIndex) + ")."); + throw std::invalid_argument("CompositeDomain has too few parts (" + + std::to_string(cd.getNParts()) + + ") for MultiDomainFunction (max index " + + std::to_string(m_maxIndex) + ")."); } // domain and values must be consistent if (cd.size() != values.size()) { @@ -148,11 +147,10 @@ void MultiDomainFunction::functionDeriv(const FunctionDomain &domain, const CompositeDomain &cd = dynamic_cast<const CompositeDomain &>(domain); // domain must not have less parts than m_maxIndex if (cd.getNParts() < m_maxIndex) { - throw std::invalid_argument( - "CompositeDomain has too few parts (" + - boost::lexical_cast<std::string>(cd.getNParts()) + - ") for MultiDomainFunction (max index " + - boost::lexical_cast<std::string>(m_maxIndex) + ")."); + throw std::invalid_argument("CompositeDomain has too few parts (" + + std::to_string(cd.getNParts()) + + ") for MultiDomainFunction (max index " + + std::to_string(m_maxIndex) + ")."); } countValueOffsets(cd); @@ -207,9 +205,9 @@ MultiDomainFunction::getLocalAttribute(size_t i, } else if (it->second.size() == 1 && it->second.front() == i) { return IFunction::Attribute("i"); } else if (!it->second.empty()) { - std::string out(boost::lexical_cast<std::string>(it->second.front())); + std::string out(std::to_string(front())); for (auto i = it->second.begin() + 1; i != it->second.end(); ++it) { - out += "," + boost::lexical_cast<std::string>(*i); + out += "," + std::to_string(*i); } return IFunction::Attribute(out); } @@ -339,7 +337,7 @@ MultiDomainFunction::createEquivalentFunctions() const { auto fun = compositeFunctions[i]; if (!fun || fun->nFunctions() == 0) { throw std::runtime_error("There is no function for domain " + - boost::lexical_cast<std::string>(i)); + std::to_string(i)); } if (fun->nFunctions() > 1) { outFunctions[i] = fun; diff --git a/Framework/API/src/ParameterTie.cpp b/Framework/API/src/ParameterTie.cpp index b88ffb79c1a..bbe6b9e8dcc 100644 --- a/Framework/API/src/ParameterTie.cpp +++ b/Framework/API/src/ParameterTie.cpp @@ -100,7 +100,7 @@ void ParameterTie::set(const std::string &expr) { m_expression = ""; while (boost::regex_search(start, end, res, rx)) { m_expression.append(start, res[0].first); - m_expression += "#" + boost::lexical_cast<std::string>(varNames[res[1]]); + m_expression += "#" + std::to_string(varNames[res[1]]); start = res[0].second; } m_expression.append(start, end); diff --git a/Framework/API/src/SpectraAxis.cpp b/Framework/API/src/SpectraAxis.cpp index a346f70362c..4c49ffce0ef 100644 --- a/Framework/API/src/SpectraAxis.cpp +++ b/Framework/API/src/SpectraAxis.cpp @@ -160,7 +160,7 @@ bool SpectraAxis::operator==(const Axis &axis2) const { * @return label of requested axis index */ std::string SpectraAxis::label(const std::size_t &index) const { - return "sp-" + boost::lexical_cast<std::string>(spectraNo(index)); + return "sp-" + std::to_string(spectraNo(index)); } /// returns min value defined on axis diff --git a/Framework/Algorithms/src/CalculateFlatBackground.cpp b/Framework/Algorithms/src/CalculateFlatBackground.cpp index 59a8bd7098a..59dc38ed5ad 100644 --- a/Framework/Algorithms/src/CalculateFlatBackground.cpp +++ b/Framework/Algorithms/src/CalculateFlatBackground.cpp @@ -154,7 +154,7 @@ void CalculateFlatBackground::exec() { // not every spectra is the monitor or detector, some spectra have no // instrument components attached. g_log.information(" Can not find detector for spectra N: " + - boost::lexical_cast<std::string>(currentSpec) + + std::to_string(currentSpec) + " Processing background anyway\n"); } } diff --git a/Framework/Algorithms/src/CalculateTransmission.cpp b/Framework/Algorithms/src/CalculateTransmission.cpp index 224f7277fcb..cba4d56d349 100644 --- a/Framework/Algorithms/src/CalculateTransmission.cpp +++ b/Framework/Algorithms/src/CalculateTransmission.cpp @@ -51,7 +51,7 @@ size_t getIndexFromDetectorID(MatrixWorkspace_sptr ws, detid_t detid) { if (result.empty()) throw std::invalid_argument( "Could not find the spectra corresponding to detector ID " + - boost::lexical_cast<std::string>(detid)); + std::to_string(detid)); return result[0]; } @@ -192,10 +192,10 @@ void CalculateTransmission::exec() { BOOST_FOREACH (size_t transmissionIndex, transmissionIndices) if (transmissionIndex == beamMonitorIndex) - throw std::invalid_argument( - "The IncidentBeamMonitor UDET (" + - boost::lexical_cast<std::string>(transmissionIndex) + - ") matches a UDET given in " + transPropName + "."); + throw std::invalid_argument("The IncidentBeamMonitor UDET (" + + std::to_string(transmissionIndex) + + ") matches a UDET given in " + + transPropName + "."); } MatrixWorkspace_sptr sampleInc; @@ -495,8 +495,7 @@ CalculateTransmission::rebin(std::vector<double> &binParams, void CalculateTransmission::logIfNotMonitor(API::MatrixWorkspace_sptr sampleWS, API::MatrixWorkspace_sptr directWS, size_t index) { - const std::string message = "The detector at index " + - boost::lexical_cast<std::string>(index) + + const std::string message = "The detector at index " + std::to_string(index) + " is not a monitor in the "; if (!sampleWS->getDetector(index)->isMonitor()) g_log.information(message + "sample workspace."); diff --git a/Framework/Algorithms/src/ConvertEmptyToTof.cpp b/Framework/Algorithms/src/ConvertEmptyToTof.cpp index ace777b2e73..fb46e5a8010 100644 --- a/Framework/Algorithms/src/ConvertEmptyToTof.cpp +++ b/Framework/Algorithms/src/ConvertEmptyToTof.cpp @@ -177,7 +177,7 @@ void ConvertEmptyToTof::validateWorkspaceIndices(std::vector<int> &v) { for (auto index : v) { if (index < 0 || static_cast<size_t>(index) >= nHist) { throw std::runtime_error("Spectra index out of limits: " + - boost::lexical_cast<std::string>(index)); + std::to_string(index)); } } } @@ -202,7 +202,7 @@ void ConvertEmptyToTof::validateChannelIndices(std::vector<int> &v) { for (auto &index : v) { if (index < 0 || static_cast<size_t>(index) >= blockSize) { throw std::runtime_error("Channel index out of limits: " + - boost::lexical_cast<std::string>(index)); + std::to_string(index)); } } } diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp index 743105d667f..202c5beee7a 100644 --- a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp +++ b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp @@ -142,17 +142,16 @@ void CreateTransmissionWorkspaceAuto::exec() { instrument->getNumberParameter("PointDetectorStop")[0]); if (analysis_mode == "PointDetectorAnalysis") { if (start == stop) { - processing_commands = boost::lexical_cast<std::string>(start); + processing_commands = std::to_string(start); } else { - processing_commands = boost::lexical_cast<std::string>(start) + ":" + - boost::lexical_cast<std::string>(stop); + processing_commands = + std::to_string(start) + ":" + std::to_string(stop); } } else { processing_commands = - boost::lexical_cast<std::string>(static_cast<int>( + std::to_string(static_cast<int>( instrument->getNumberParameter("MultiDetectorStart")[0])) + - ":" + - boost::lexical_cast<std::string>(firstWS->getNumberHistograms() - 1); + ":" + std::to_string(firstWS->getNumberHistograms() - 1); } } else { std::string processing_commands_temp = diff --git a/Framework/Algorithms/src/GetAllEi.cpp b/Framework/Algorithms/src/GetAllEi.cpp index d306eef3853..c0889d0bc54 100644 --- a/Framework/Algorithms/src/GetAllEi.cpp +++ b/Framework/Algorithms/src/GetAllEi.cpp @@ -285,7 +285,7 @@ void GetAllEi::exec() { } } g_log.debug() << "*From all chopper opening only: " + - boost::lexical_cast<std::string>(guess_ei.size()) + + std::to_string(guess_ei.size()) + " fell within both monitor's recording energy range\n"; g_log.debug() << " Guess Energies are:\n"; for (double ei : guess_ei) { @@ -323,7 +323,7 @@ void GetAllEi::exec() { irange1_max.assign(irange_max.begin(), irange_max.end()); } g_log.debug() - << "*Identified: " + boost::lexical_cast<std::string>(guess_ei.size()) + + << "*Identified: " + std::to_string(guess_ei.size()) + " peaks with sufficient signal around guess chopper opening\n"; std::vector<peakKeeper> peaks; @@ -557,21 +557,18 @@ bool GetAllEi::peakGuess(const API::MatrixWorkspace_sptr &inputWS, size_t index, } if (iterations_fail) { g_log.information() << "*No peak search convergence after " + - boost::lexical_cast<std::string>(ic) + + std::to_string(ic) + " smoothing iterations at still_count: " + - boost::lexical_cast<std::string>( - stay_still_count) + + std::to_string(stay_still_count) + " Wrong energy or noisy peak at Ei=" + boost::lexical_cast<std::string>(Ei) << std::endl; } - g_log.debug() << "*Performed: " + boost::lexical_cast<std::string>(ic) + - " averages for spectra " + - boost::lexical_cast<std::string>(index) + + g_log.debug() << "*Performed: " + std::to_string(ic) + + " averages for spectra " + std::to_string(index) + " at energy: " + boost::lexical_cast<std::string>(Ei) + - "\n and found: " + - boost::lexical_cast<std::string>(nPeaks) + "peaks and " + - boost::lexical_cast<std::string>(nHills) + " hills\n"; + "\n and found: " + std::to_string(nPeaks) + + "peaks and " + std::to_string(nHills) + " hills\n"; if (nPeaks != 1) { g_log.debug() << "*Peak rejected as n-peaks !=1 after averaging\n"; return false; @@ -586,10 +583,8 @@ bool GetAllEi::peakGuess(const API::MatrixWorkspace_sptr &inputWS, size_t index, peakTwoSigma = hillsPos[1] - hillsPos[0]; } else { g_log.debug() << "*Peak rejected as averaging gives: " + - boost::lexical_cast<std::string>(nPeaks) + - " peaks and " + - boost::lexical_cast<std::string>(nHills) + - " heals\n"; + std::to_string(nPeaks) + " peaks and " + + std::to_string(nHills) + " heals\n"; return false; } @@ -1249,7 +1244,7 @@ std::map<std::string, std::string> GetAllEi::validateInputs() { } catch (std::runtime_error &) { result["Monitor1SpecID"] = "Input workspace does not contain spectra with ID: " + - boost::lexical_cast<std::string>(specNum1); + std::to_string(specNum1); } specnum_t specNum2 = getProperty("Monitor2SpecID"); try { @@ -1257,7 +1252,7 @@ std::map<std::string, std::string> GetAllEi::validateInputs() { } catch (std::runtime_error &) { result["Monitor2SpecID"] = "Input workspace does not contain spectra with ID: " + - boost::lexical_cast<std::string>(specNum2); + std::to_string(specNum2); } // check chopper and initiate it if present (for debugging) m_chopper = inputWS->getInstrument()->getComponentByName("chopper-position"); diff --git a/Framework/Algorithms/src/GetEi2.cpp b/Framework/Algorithms/src/GetEi2.cpp index 72422cb033b..eda497f27c0 100644 --- a/Framework/Algorithms/src/GetEi2.cpp +++ b/Framework/Algorithms/src/GetEi2.cpp @@ -237,7 +237,7 @@ double GetEi2::calculateEi(const double initial_guess) { if (!m_fixedei) { throw std::invalid_argument( "No peak found for the monitor with spectra num: " + - boost::lexical_cast<std::string>(spec_nums[i]) + " (at " + + std::to_string(spec_nums[i]) + " (at " + boost::lexical_cast<std::string>(det_distances[i]) + " metres from source).\n"); } else { diff --git a/Framework/Algorithms/src/He3TubeEfficiency.cpp b/Framework/Algorithms/src/He3TubeEfficiency.cpp index e8e04bcf1e4..69c1db0bc97 100644 --- a/Framework/Algorithms/src/He3TubeEfficiency.cpp +++ b/Framework/Algorithms/src/He3TubeEfficiency.cpp @@ -257,7 +257,7 @@ void He3TubeEfficiency::getDetectorGeometry( if (!shape_sptr) { throw std::runtime_error( "Detector geometry error: detector with id: " + - boost::lexical_cast<std::string>(det->getID()) + + std::to_string(det->getID()) + " does not have shape. Is this a detectors group?\n" "The algorithm works for instruments with one-to-one " "spectra-to-detector maps only!"); diff --git a/Framework/Algorithms/src/PolarizationCorrection.cpp b/Framework/Algorithms/src/PolarizationCorrection.cpp index 5654a2e3a58..cc4baa6c117 100644 --- a/Framework/Algorithms/src/PolarizationCorrection.cpp +++ b/Framework/Algorithms/src/PolarizationCorrection.cpp @@ -332,8 +332,7 @@ WorkspaceGroup_sptr PolarizationCorrection::execPA(WorkspaceGroup_sptr inWS) { for (size_t i = 1; i < totalGroupEntries; i++) { auto alg = this->createChildAlgorithm("ReplaceSpecialValues"); alg->setProperty("InputWorkspace", dataOut->getItem(i)); - alg->setProperty("OutputWorkspace", - "dataOut_" + boost::lexical_cast<std::string>(i)); + alg->setProperty("OutputWorkspace", "dataOut_" + std::to_string(i)); alg->setProperty("NaNValue", 0.0); alg->setProperty("NaNError", 0.0); alg->setProperty("InfinityValue", 0.0); diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp index a83cbfa1995..d2cc5eb2dfd 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp @@ -319,11 +319,11 @@ void ReflectometryReductionOneAuto::exec() { if (detStart == detStop) { // If the range given only specifies one detector, we pass along just // that one detector - processing_commands = boost::lexical_cast<std::string>(detStart); + processing_commands = std::to_string(detStart); } else { // Otherwise, we create a range. - processing_commands = boost::lexical_cast<std::string>(detStart) + ":" + - boost::lexical_cast<std::string>(detStop); + processing_commands = + std::to_string(detStart) + ":" + std::to_string(detStop); } } else { std::vector<double> multiStart = @@ -334,10 +334,9 @@ void ReflectometryReductionOneAuto::exec() { "must exist as an instrument parameter.\n" "Please check if you meant to enter ProcessingInstructions or " "if your instrument parameter file is correct."); - processing_commands = - boost::lexical_cast<std::string>(static_cast<int>(multiStart[0])) + - ":" + - boost::lexical_cast<std::string>(in_ws->getNumberHistograms() - 1); + processing_commands = std::to_string(static_cast<int>(multiStart[0])) + + ":" + + std::to_string(in_ws->getNumberHistograms() - 1); } } else { std::string processing_commands_temp = @@ -735,10 +734,8 @@ bool ReflectometryReductionOneAuto::processGroups() { // multiperiod) size_t numMembers = group->size(); for (size_t i = 0; i < numMembers; ++i) { - const std::string IvsQName = - outputIvsQ + "_" + boost::lexical_cast<std::string>(i + 1); - const std::string IvsLamName = - outputIvsLam + "_" + boost::lexical_cast<std::string>(i + 1); + const std::string IvsQName = outputIvsQ + "_" + std::to_string(i + 1); + const std::string IvsLamName = outputIvsLam + "_" + std::to_string(i + 1); // If our transmission run is a group and PolarizationCorrection is on // then we sum our transmission group members. @@ -818,10 +815,9 @@ bool ReflectometryReductionOneAuto::processGroups() { alg->setProperty("FirstTransmissionRun", ""); alg->setProperty("SecondTransmissionRun", ""); for (size_t i = 0; i < numMembers; ++i) { - const std::string IvsQName = - outputIvsQ + "_" + boost::lexical_cast<std::string>(i + 1); + const std::string IvsQName = outputIvsQ + "_" + std::to_string(i + 1); const std::string IvsLamName = - outputIvsLam + "_" + boost::lexical_cast<std::string>(i + 1); + outputIvsLam + "_" + std::to_string(i + 1); alg->setProperty("InputWorkspace", IvsLamName); alg->setProperty("OutputWorkspace", IvsQName); alg->setProperty("CorrectionAlgorithm", "None"); diff --git a/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp b/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp index cfd460f9616..2004e9e8d3c 100644 --- a/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp +++ b/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp @@ -131,7 +131,7 @@ double SANSCollimationLengthEstimator::getCollimationLengthWithGuides( // else then default std::vector<double> guideValues; for (unsigned int i = 1; i <= numberOfGuides; i++) { - auto guideName = "Guide" + boost::lexical_cast<std::string>(i); + auto guideName = "Guide" + std::to_string(i); if (inOutWS->run().hasProperty(guideName)) { auto guideValue = getGuideValue(inOutWS->run().getProperty(guideName)); guideValues.push_back(guideValue); diff --git a/Framework/Algorithms/src/SofQWCentre.cpp b/Framework/Algorithms/src/SofQWCentre.cpp index 9a076405cf6..26d6df74bb0 100644 --- a/Framework/Algorithms/src/SofQWCentre.cpp +++ b/Framework/Algorithms/src/SofQWCentre.cpp @@ -185,9 +185,8 @@ void SofQWCentre::exec() { std::string mess = "Energy transfer requested in Direct mode exceeds incident " "energy.\n Found for det ID: " + - boost::lexical_cast<std::string>(idet) + " bin No " + - boost::lexical_cast<std::string>(j) + " with Ei=" + - boost::lexical_cast<std::string>(efixed) + + std::to_string(idet) + " bin No " + std::to_string(j) + + " with Ei=" + boost::lexical_cast<std::string>(efixed) + " and energy transfer: " + boost::lexical_cast<std::string>(deltaE); throw std::runtime_error(mess); @@ -199,9 +198,8 @@ void SofQWCentre::exec() { std::string mess = "Incident energy of a neutron is negative. Are you trying to " "process Direct data in Indirect mode?\n Found for det ID: " + - boost::lexical_cast<std::string>(idet) + " bin No " + - boost::lexical_cast<std::string>(j) + " with efied=" + - boost::lexical_cast<std::string>(efixed) + + std::to_string(idet) + " bin No " + std::to_string(j) + + " with efied=" + boost::lexical_cast<std::string>(efixed) + " and energy transfer: " + boost::lexical_cast<std::string>(deltaE); throw std::runtime_error(mess); diff --git a/Framework/Algorithms/src/Stitch1D.cpp b/Framework/Algorithms/src/Stitch1D.cpp index bb14fb8e9cc..26e770d3557 100644 --- a/Framework/Algorithms/src/Stitch1D.cpp +++ b/Framework/Algorithms/src/Stitch1D.cpp @@ -380,10 +380,8 @@ MatrixWorkspace_sptr Stitch1D::multiplyRange(MatrixWorkspace_sptr &input, multiplyRange->setProperty("StartBin", startBin); multiplyRange->setProperty("EndBin", endBin); multiplyRange->setProperty("Factor", factor); - g_log.information("MultiplyRange StartBin: " + - boost::lexical_cast<std::string>(startBin)); - g_log.information("MultiplyRange EndBin: " + - boost::lexical_cast<std::string>(endBin)); + g_log.information("MultiplyRange StartBin: " + std::to_string(startBin)); + g_log.information("MultiplyRange EndBin: " + std::to_string(endBin)); g_log.information("MultiplyRange Factor: " + boost::lexical_cast<std::string>(factor)); multiplyRange->execute(); @@ -404,8 +402,7 @@ MatrixWorkspace_sptr Stitch1D::multiplyRange(MatrixWorkspace_sptr &input, multiplyRange->setProperty("InputWorkspace", input); multiplyRange->setProperty("StartBin", startBin); multiplyRange->setProperty("Factor", factor); - g_log.information("MultiplyRange StartBin: " + - boost::lexical_cast<std::string>(startBin)); + g_log.information("MultiplyRange StartBin: " + std::to_string(startBin)); g_log.information("MultiplyRange Factor: " + boost::lexical_cast<std::string>(factor)); multiplyRange->execute(); diff --git a/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp b/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp index 5125d1ca959..38fe1a82372 100644 --- a/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp +++ b/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp @@ -211,7 +211,7 @@ void GoniometerAnglesFromPhiRotation::exec() { } int RunNum = PeaksRun2->getPeak(0).getRunNumber(); - std::string RunNumStr = boost::lexical_cast<std::string>(RunNum); + std::string RunNumStr = std::to_string(RunNum); int Npeaks = PeaksRun2->getNumberPeaks(); // n indexed, av err, phi, chi,omega diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp index 2f7987fb853..c5102073175 100644 --- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp +++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp @@ -1597,7 +1597,7 @@ void IntegratePeakTimeSlices::SetUpData1( workspaceIndex = m_wi_to_detid_map.find(DetID)->second; else { throw std::runtime_error("No workspaceIndex for detID=" + - boost::lexical_cast<std::string>(DetID)); + std::to_string(DetID)); } IDetector_const_sptr Det = inpWkSpace->getDetector(workspaceIndex); @@ -1610,7 +1610,7 @@ void IntegratePeakTimeSlices::SetUpData1( if (dist.scalar_prod(dist) < Radius * Radius) { - spec_idList += boost::lexical_cast<std::string>( + spec_idList += std::to_string( inpWkSpace->getSpectrum(workspaceIndex)->getSpectrumNo()); double R1 = dist.scalar_prod(m_yvec); diff --git a/Framework/Crystal/src/LoadIsawPeaks.cpp b/Framework/Crystal/src/LoadIsawPeaks.cpp index 040de5fc13a..874a7320ab7 100644 --- a/Framework/Crystal/src/LoadIsawPeaks.cpp +++ b/Framework/Crystal/src/LoadIsawPeaks.cpp @@ -196,7 +196,7 @@ LoadIsawPeaks::ApplyCalibInfo(std::ifstream &in, std::string startChar, throw std::length_error("incorrect type of data for panel "); } - std::string SbankNum = boost::lexical_cast<std::string>(bankNum); + std::string SbankNum = std::to_string(bankNum); std::string bankName = "bank"; if (instr->getName() == "WISH") { if (bankNum < 10) diff --git a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp index 9fc7fa5ad2a..5ca37a276c2 100644 --- a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp +++ b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp @@ -248,7 +248,7 @@ void OptimizeCrystalPlacement::exec() { } if (it1 == NOoptimizeRuns.end()) { - std::string runNumStr = boost::lexical_cast<std::string>(runNum); + std::string runNumStr = std::to_string(runNum); OptRunNums += predChar + runNumStr; predChar = "/"; ChRunNumList.push_back(runNumStr); @@ -474,7 +474,7 @@ void OptimizeCrystalPlacement::exec() { for (int i = 0; i < OutPeaks->getNumberPeaks(); ++i) { int RunNum = OutPeaks->getPeak(i).getRunNumber(); - std::string RunNumStr = boost::lexical_cast<std::string>(RunNum); + std::string RunNumStr = std::to_string(RunNum); Matrix<double> GonMatrix; if (RunNum == prevRunNum || MapRunNum2GonMat.find(RunNum) != MapRunNum2GonMat.end()) diff --git a/Framework/Crystal/src/OptimizeLatticeForCellType.cpp b/Framework/Crystal/src/OptimizeLatticeForCellType.cpp index 0f86fab87fe..0c900ea0316 100644 --- a/Framework/Crystal/src/OptimizeLatticeForCellType.cpp +++ b/Framework/Crystal/src/OptimizeLatticeForCellType.cpp @@ -111,8 +111,7 @@ void OptimizeLatticeForCellType::exec() { runWS[count]->addPeak(peak); run = peak.getRunNumber(); AnalysisDataService::Instance().addOrReplace( - boost::lexical_cast<std::string>(run) + ws->getName(), - runWS[count]); + std::to_string(run) + ws->getName(), runWS[count]); } else { runWS[count]->addPeak(peak); } diff --git a/Framework/Crystal/src/PeakHKLErrors.cpp b/Framework/Crystal/src/PeakHKLErrors.cpp index d6365f23b3d..46f7017d4b9 100644 --- a/Framework/Crystal/src/PeakHKLErrors.cpp +++ b/Framework/Crystal/src/PeakHKLErrors.cpp @@ -245,7 +245,7 @@ void PeakHKLErrors::getRun2MatMap( Geometry::IPeak &peak_old = Peaks->getPeak(i); int runNum = peak_old.getRunNumber(); - std::string runNumStr = boost::lexical_cast<std::string>(runNum); + std::string runNumStr = std::to_string(runNum); size_t N = OptRuns.find("/" + runNumStr + "/"); if (N < OptRuns.size()) { double chi = @@ -376,7 +376,7 @@ void PeakHKLErrors::function1D(double *out, const double *xValues, IPeak &peak_old = Peaks->getPeak(peakNum); int runNum = peak_old.getRunNumber(); - std::string runNumStr = boost::lexical_cast<std::string>(runNum); + std::string runNumStr = std::to_string(runNum); Peak peak = SCDPanelErrors::createNewPeak(peak_old, instNew, 0, peak_old.getL1()); @@ -475,7 +475,7 @@ void PeakHKLErrors::functionDeriv1D(Jacobian *out, const double *xValues, SCDPanelErrors::createNewPeak(peak_old, instNew, 0, peak_old.getL1()); int runNum = peak_old.getRunNumber(); - std::string runNumStr = boost::lexical_cast<std::string>(runNum); + std::string runNumStr = std::to_string(runNum); for (int kk = 0; kk < static_cast<int>(nParams()); kk++) { out->set(i, kk, 0.0); diff --git a/Framework/Crystal/src/SCDCalibratePanels.cpp b/Framework/Crystal/src/SCDCalibratePanels.cpp index ed5a58f826e..fb14ce1a275 100644 --- a/Framework/Crystal/src/SCDCalibratePanels.cpp +++ b/Framework/Crystal/src/SCDCalibratePanels.cpp @@ -785,7 +785,7 @@ void SCDCalibratePanels::exec() { g_log.error() << "Bank Group " << BankNameString << " does not have enough peaks for fitting" << endl; saveIsawDetCal(instrument, MyBankNames, T0_bank, - DetCalFileName + boost::lexical_cast<std::string>(iGr)); + DetCalFileName + std::to_string(iGr)); continue; } @@ -1002,7 +1002,7 @@ void SCDCalibratePanels::exec() { //-----------------------or xml(for LoadParameterFile) files----------- this->progress(.94, "Saving detcal file"); saveIsawDetCal(NewInstrument, MyBankNames, result["t0"], - DetCalFileName + boost::lexical_cast<std::string>(iGr)); + DetCalFileName + std::to_string(iGr)); this->progress(.96, "Saving xml param file"); string XmlFileName = getProperty("XmlFilename"); @@ -1024,8 +1024,7 @@ void SCDCalibratePanels::exec() { std::vector<double> l0vec, t0vec; std::string line, seven; for (int iGr = 0; iGr < nGroups; iGr++) { - std::ifstream infile(DetCalFileName + - boost::lexical_cast<std::string>(iGr)); + std::ifstream infile(DetCalFileName + std::to_string(iGr)); while (std::getline(infile, line)) { if (iGr == 0 && iIter == nIter - 1) { if (line[0] == '#' || line[0] == '6') @@ -1040,10 +1039,8 @@ void SCDCalibratePanels::exec() { detcal.push_back(line); } infile.close(); - if (Poco::File(DetCalFileName + boost::lexical_cast<std::string>(iGr)) - .exists()) - Poco::File(DetCalFileName + boost::lexical_cast<std::string>(iGr)) - .remove(); + if (Poco::File(DetCalFileName + std::to_string(iGr)).exists()) + Poco::File(DetCalFileName + std::to_string(iGr)).remove(); } if (useL0) { removeOutliers(l0vec); @@ -1208,7 +1205,7 @@ void SCDCalibratePanels::LoadISawDetCal( depth >> detd >> x >> y >> z >> base_x >> base_y >> base_z >> up_x >> up_y >> up_z; - string bankName = bankPrefixName + boost::lexical_cast<string>(id); + string bankName = bankPrefixName + std::to_string(id); if (!AllBankName.empty() && AllBankName.find(bankName) == AllBankName.end()) continue; @@ -1316,7 +1313,7 @@ void SCDCalibratePanels::createResultWorkspace(const int numGroups, Result->addColumn("str", "Field"); // and one for each group for (int g = 0; g < numGroups; ++g) { - string GroupName = string("Group") + boost::lexical_cast<string>(g); + string GroupName = string("Group") + std::to_string(g); Result->addColumn("double", GroupName); } Result->setRowCount(2 * (10 + nn)); diff --git a/Framework/Crystal/src/SCDPanelErrors.cpp b/Framework/Crystal/src/SCDPanelErrors.cpp index fb614355ba2..d3265e1fe35 100644 --- a/Framework/Crystal/src/SCDPanelErrors.cpp +++ b/Framework/Crystal/src/SCDPanelErrors.cpp @@ -324,7 +324,7 @@ SCDPanelErrors::getNewInstrument(const Geometry::IPeak &peak) const { boost::split(GroupBanks, BankNames, boost::is_any_of("!")); for (size_t group = 0; group < (size_t)GroupBanks.size(); ++group) { - string prefix = "f" + boost::lexical_cast<std::string>(group) + "_"; + string prefix = "f" + std::to_string(group) + "_"; std::vector<std::string> bankNames; Quat rot = Quat(getParameter(prefix + "Xrot"), Kernel::V3D(1.0, 0.0, 0.0)) * @@ -692,7 +692,7 @@ void SCDPanelErrors::setAttribute(const std::string &attName, } NGroups = value.asInt(); for (int k = 1; k < NGroups; ++k) { - std::string prefix = "f" + boost::lexical_cast<std::string>(k) + "_"; + std::string prefix = "f" + std::to_string(k) + "_"; declareParameter(prefix + "detWidthScale", 1.0, "panel Width"); declareParameter(prefix + "detHeightScale", 1.0, "panelHeight"); diff --git a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp index c91491ac0e1..297ce969624 100644 --- a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp +++ b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp @@ -121,7 +121,7 @@ void StatisticsOfPeaksWorkspace::exec() { else oldSequence = "0.5 - 0.0"; } else if (sortType.compare(0, 2, "Ru") == 0) - oldSequence = boost::lexical_cast<std::string>(peaks[0].getRunNumber()); + oldSequence = std::to_string(peaks[0].getRunNumber()); else oldSequence = peaks[0].getBankName(); // Go through each peak at this run / bank @@ -146,7 +146,7 @@ void StatisticsOfPeaksWorkspace::exec() { else sequence = "0.5 - 0.0"; } else if (sortType.compare(0, 2, "Ru") == 0) - sequence = boost::lexical_cast<std::string>(p.getRunNumber()); + sequence = std::to_string(p.getRunNumber()); else sequence = p.getBankName(); diff --git a/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp index cd2bdecbdeb..e40b2eeb053 100644 --- a/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp +++ b/Framework/CurveFitting/src/Algorithms/ConvertToYSpace.cpp @@ -70,7 +70,7 @@ DetectorParams ConvertToYSpace::getDetectorParameters( } catch (Kernel::Exception::NotFoundError &) { throw std::invalid_argument("ConvertToYSpace - Workspace has no detector " "attached to histogram at index " + - boost::lexical_cast<std::string>(index)); + std::to_string(index)); } DetectorParams detpar; @@ -205,8 +205,7 @@ void ConvertToYSpace::exec() { PARALLEL_START_INTERUPT_REGION if (!convert(i)) { - g_log.warning("No detector defined for index=" + - boost::lexical_cast<std::string>(i) + + g_log.warning("No detector defined for index=" + std::to_string(i) + ". Zeroing spectrum."); m_outputWS->maskWorkspaceIndex(i); if (m_qOutputWS) diff --git a/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp index 03c8fe83b42..b58c0a49f8b 100644 --- a/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp +++ b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp @@ -152,7 +152,7 @@ void EstimatePeakErrors::exec() { size_t np = fun->nParams(); IPeakFunction *peak = dynamic_cast<IPeakFunction *>(fun); if (peak) { - std::string prefix = "f" + boost::lexical_cast<std::string>(i) + "."; + std::string prefix = "f" + std::to_string(i) + "."; GSLMatrix covariance(*matrix, ip, ip, np, np); calculatePeakValues(*peak, *results, covariance, prefix); } diff --git a/Framework/CurveFitting/src/Algorithms/Fit.cpp b/Framework/CurveFitting/src/Algorithms/Fit.cpp index 6de5427ddc9..7805de53b27 100644 --- a/Framework/CurveFitting/src/Algorithms/Fit.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit.cpp @@ -197,8 +197,7 @@ void Fit::execConcrete() { if (!errorString.empty()) { errorString += '\n'; } - errorString += "Failed to converge after " + - boost::lexical_cast<std::string>(maxIterations) + + errorString += "Failed to converge after " + std::to_string(maxIterations) + " iterations."; } diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index 348bf1a30f2..c63e476a28c 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -262,7 +262,7 @@ void PlotPeakByLogValue::exec() { << " with " << std::endl; g_log.debug() << ifun->asString() << std::endl; - const std::string spectrum_index = boost::lexical_cast<std::string>(j); + const std::string spectrum_index = std::to_string(j); std::string wsBaseName = ""; if (createFitOutput) @@ -326,7 +326,7 @@ void PlotPeakByLogValue::exec() { row << chi2; Prog += dProg; - std::string current = boost::lexical_cast<std::string>(i); + std::string current = std::to_string(i); progress(Prog, ("Fitting Workspace: (" + current + ") - ")); interruption_point(); @@ -418,8 +418,7 @@ PlotPeakByLogValue::getWorkspace(const InputData &data) { boost::dynamic_pointer_cast<API::WorkspaceGroup>(rws); if (gws) { std::string propName = - "OUTPUTWORKSPACE_" + - boost::lexical_cast<std::string>(data.period); + "OUTPUTWORKSPACE_" + std::to_string(period); if (load->existsProperty(propName)) { Workspace_sptr rws1 = load->getProperty(propName); out.ws = diff --git a/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp index 1e6961f4fa9..8fe6b26a167 100644 --- a/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp @@ -180,7 +180,7 @@ SplineSmoothing::setupOutputWorkspace(API::MatrixWorkspace_const_sptr inws, // create labels for output workspace auto tAxis = new API::TextAxis(size); for (int i = 0; i < size; ++i) { - std::string index = boost::lexical_cast<std::string>(i); + std::string index = std::to_string(i); tAxis->setLabel(i, "Y" + index); } outputWorkspace->replaceAxis(1, tAxis); diff --git a/Framework/CurveFitting/src/Algorithms/VesuvioCalculateGammaBackground.cpp b/Framework/CurveFitting/src/Algorithms/VesuvioCalculateGammaBackground.cpp index 474ca1ddc5f..65f5f1b82d5 100644 --- a/Framework/CurveFitting/src/Algorithms/VesuvioCalculateGammaBackground.cpp +++ b/Framework/CurveFitting/src/Algorithms/VesuvioCalculateGammaBackground.cpp @@ -126,8 +126,7 @@ void VesuvioCalculateGammaBackground::exec() { if (!calculateBackground(inputIndex, outputIndex)) { g_log.information("No detector defined for index=" + - boost::lexical_cast<std::string>(inputIndex) + - ". Skipping correction."); + std::to_string(inputIndex) + ". Skipping correction."); } PARALLEL_END_INTERUPT_REGION @@ -164,8 +163,7 @@ bool VesuvioCalculateGammaBackground::calculateBackground( spectrumNo <= FORWARD_SCATTER_SPECMAX) { applyCorrection(inputIndex, outputIndex); } else { - g_log.information("Spectrum " + - boost::lexical_cast<std::string>(spectrumNo) + + g_log.information("Spectrum " + std::to_string(spectrumNo) + " not in forward scatter range. Skipping correction."); // Leave background at 0 and just copy data to corrected m_correctedWS->dataY(outputIndex) = m_inputWS->readY(inputIndex); diff --git a/Framework/CurveFitting/src/Algorithms/VesuvioCalculateMS.cpp b/Framework/CurveFitting/src/Algorithms/VesuvioCalculateMS.cpp index 62a5ea88b5e..3b62bea10d5 100644 --- a/Framework/CurveFitting/src/Algorithms/VesuvioCalculateMS.cpp +++ b/Framework/CurveFitting/src/Algorithms/VesuvioCalculateMS.cpp @@ -334,16 +334,14 @@ void VesuvioCalculateMS::calculateMS(const size_t wsIndex, // Final counts averaged over all simulations CurveFitting::MSVesuvioHelper::SimulationAggregator accumulator(m_nruns); for (size_t i = 0; i < m_nruns; ++i) { - m_progress->report("MS calculation: idx=" + - boost::lexical_cast<std::string>(wsIndex) + ", run=" + - boost::lexical_cast<std::string>(i)); + m_progress->report("MS calculation: idx=" + std::to_string(wsIndex) + + ", run=" + std::to_string(i)); simulate(detpar, respar, accumulator.newSimulation(m_nscatters, m_inputWS->blocksize())); - m_progress->report("MS calculation: idx=" + - boost::lexical_cast<std::string>(wsIndex) + ", run=" + - boost::lexical_cast<std::string>(i)); + m_progress->report("MS calculation: idx=" + std::to_string(wsIndex) + + ", run=" + std::to_string(i)); } // Average over all runs and assign to output workspaces diff --git a/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp index 87788ddb42b..c8a16f407f7 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp @@ -369,8 +369,7 @@ bool FABADAMinimizer::iterate(size_t) { } failed.replace(failed.end() - 2, failed.end(), "."); throw std::runtime_error( - "Convegence NOT reached after " + - boost::lexical_cast<std::string>(m_max_iter) + + "Convegence NOT reached after " + std::to_string(m_max_iter) + " iterations.\n Try to set better initial values for parameters: " + failed); } diff --git a/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp index 47ea79c0e31..7f8c22a1b51 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp @@ -67,8 +67,8 @@ void LevenbergMarquardtMinimizer::initialize( if (!m_gslSolver) { throw std::runtime_error( "Levenberg-Marquardt minimizer failed to initialize. \n" + - boost::lexical_cast<std::string>(m_data->n) + " data points, " + - boost::lexical_cast<std::string>(m_data->p) + " fitting parameters. "); + std::to_string(m_data->n) + " data points, " + + std::to_string(m_data->p) + " fitting parameters. "); } gsl_multifit_fdfsolver_set(m_gslSolver, &gslContainer, m_data->initFuncParams); diff --git a/Framework/CurveFitting/src/Functions/BSpline.cpp b/Framework/CurveFitting/src/Functions/BSpline.cpp index e5a9bfa8e3e..4fdbcd90059 100644 --- a/Framework/CurveFitting/src/Functions/BSpline.cpp +++ b/Framework/CurveFitting/src/Functions/BSpline.cpp @@ -192,7 +192,7 @@ void BSpline::resetParameters() { } size_t np = gsl_bspline_ncoeffs(m_bsplineWorkspace.get()); for (size_t i = 0; i < np; ++i) { - std::string pname = "A" + boost::lexical_cast<std::string>(i); + std::string pname = "A" + std::to_string(i); declareParameter(pname); } } diff --git a/Framework/CurveFitting/src/Functions/Chebyshev.cpp b/Framework/CurveFitting/src/Functions/Chebyshev.cpp index 9395ced590d..446a8fcd57b 100644 --- a/Framework/CurveFitting/src/Functions/Chebyshev.cpp +++ b/Framework/CurveFitting/src/Functions/Chebyshev.cpp @@ -93,7 +93,7 @@ void Chebyshev::setAttribute(const std::string &attName, "Chebyshev: polynomial order cannot be negative."); } for (int i = 0; i <= m_n; ++i) { - std::string parName = "A" + boost::lexical_cast<std::string>(i); + std::string parName = "A" + std::to_string(i); declareParameter(parName); } } else if (attName == "StartX") { diff --git a/Framework/CurveFitting/src/Functions/ComptonProfile.cpp b/Framework/CurveFitting/src/Functions/ComptonProfile.cpp index f7710ae8389..687b46f284c 100644 --- a/Framework/CurveFitting/src/Functions/ComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonProfile.cpp @@ -98,7 +98,7 @@ void ComptonProfile::buildCaches() { } catch (Kernel::Exception::NotFoundError &) { throw std::invalid_argument("ComptonProfile - Workspace has no detector " "attached to histogram at index " + - boost::lexical_cast<std::string>(m_wsIndex)); + std::to_string(m_wsIndex)); } m_resolutionFunction->setAttributeValue("Mass", m_mass); diff --git a/Framework/CurveFitting/src/Functions/CubicSpline.cpp b/Framework/CurveFitting/src/Functions/CubicSpline.cpp index 81a80add551..61495b481e2 100644 --- a/Framework/CurveFitting/src/Functions/CubicSpline.cpp +++ b/Framework/CurveFitting/src/Functions/CubicSpline.cpp @@ -79,7 +79,7 @@ void CubicSpline::setupInput(boost::scoped_array<double> &x, bool xSortFlag = false; for (int i = 0; i < n; ++i) { - std::string num = boost::lexical_cast<std::string>(i); + std::string num = std::to_string(i); std::string xName = "x" + num; std::string yName = "y" + num; @@ -270,7 +270,7 @@ void CubicSpline::setAttribute(const std::string &attName, // check that the number of data points is in a valid range if (n > oldN) { // get the name of the last x data point - std::string oldXName = "x" + boost::lexical_cast<std::string>(oldN - 1); + std::string oldXName = "x" + std::to_string(oldN - 1); double oldX = getAttribute(oldXName).asDouble(); // reallocate gsl object to new size @@ -278,7 +278,7 @@ void CubicSpline::setAttribute(const std::string &attName, // create blank a number of new blank parameters and attributes for (int i = oldN; i < n; ++i) { - std::string num = boost::lexical_cast<std::string>(i); + std::string num = std::to_string(i); std::string newXName = "x" + num; std::string newYName = "y" + num; @@ -309,7 +309,7 @@ void CubicSpline::setXAttribute(const size_t index, double x) { // check that setting the x attribute is within our range if (index < n) { - std::string xName = "x" + boost::lexical_cast<std::string>(index); + std::string xName = "x" + std::to_string(index); setAttributeValue(xName, x); // attributes updated, flag for recalculation diff --git a/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp index 473bcf85b2a..2ae4489c9c0 100644 --- a/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp +++ b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp @@ -16,7 +16,7 @@ DECLARE_FUNCTION(FullprofPolynomial) FullprofPolynomial::FullprofPolynomial() : m_n(6), m_bkpos(1.) { // Declare first 6th order polynomial as default for (int i = 0; i < m_n; ++i) { - std::string parName = "A" + boost::lexical_cast<std::string>(i); + std::string parName = "A" + std::to_string(i); declareParameter(parName); } } @@ -130,7 +130,7 @@ void FullprofPolynomial::setAttribute(const std::string &attName, m_n = attint; for (int i = 0; i < m_n; ++i) { - std::string parName = "A" + boost::lexical_cast<std::string>(i); + std::string parName = "A" + std::to_string(i); declareParameter(parName); } } diff --git a/Framework/CurveFitting/src/Functions/Polynomial.cpp b/Framework/CurveFitting/src/Functions/Polynomial.cpp index 3b65aaa64a1..862be38c233 100644 --- a/Framework/CurveFitting/src/Functions/Polynomial.cpp +++ b/Framework/CurveFitting/src/Functions/Polynomial.cpp @@ -136,7 +136,7 @@ void Polynomial::setAttribute(const std::string &attName, "Polynomial: polynomial order cannot be negative."); } for (int i = 0; i <= m_n; ++i) { - std::string parName = "A" + boost::lexical_cast<std::string>(i); + std::string parName = "A" + std::to_string(i); declareParameter(parName); } } diff --git a/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp b/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp index 4d84564dd5a..478868b391d 100644 --- a/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp +++ b/Framework/CurveFitting/src/Functions/ReflectivityMulf.cpp @@ -286,11 +286,11 @@ void ReflectivityMulf::setAttribute(const std::string &attName, declareParameter("Resolution", coeff[6]); for (int i = 0; i < m_nlayer; ++i) { - std::string parName = "SLD_Layer" + boost::lexical_cast<std::string>(i); + std::string parName = "SLD_Layer" + std::to_string(i); declareParameter(parName, coeff[7 + i * 3]); - parName = "d_Layer" + boost::lexical_cast<std::string>(i); + parName = "d_Layer" + std::to_string(i); declareParameter(parName, coeff[8 + i * 3]); - parName = "Rough_Layer" + boost::lexical_cast<std::string>(i); + parName = "Rough_Layer" + std::to_string(i); declareParameter(parName, coeff[9 + i * 3]); } } diff --git a/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp b/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp index cafc4571446..8df6e8eac6f 100644 --- a/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp +++ b/Framework/CurveFitting/src/Functions/VesuvioResolution.cpp @@ -44,7 +44,7 @@ ResolutionParams VesuvioResolution::getResolutionParameters( } catch (Kernel::Exception::NotFoundError &) { throw std::invalid_argument("VesuvioResolution - Workspace has no detector " "attached to histogram at index " + - boost::lexical_cast<std::string>(index)); + std::to_string(index)); } ResolutionParams respar; diff --git a/Framework/CurveFitting/src/GeneralDomainCreator.cpp b/Framework/CurveFitting/src/GeneralDomainCreator.cpp index 5005b6ef9cf..086a3afbeae 100644 --- a/Framework/CurveFitting/src/GeneralDomainCreator.cpp +++ b/Framework/CurveFitting/src/GeneralDomainCreator.cpp @@ -35,7 +35,7 @@ GeneralDomainCreator::GeneralDomainCreator( m_domainColumnNames.push_back("ArgumentColumn"); for (size_t i = 1; i < nDomainColumns; ++i) { m_domainColumnNames.push_back(m_domainColumnNames.front() + "_" + - boost::lexical_cast<std::string>(i)); + std::to_string(i)); } } @@ -44,7 +44,7 @@ GeneralDomainCreator::GeneralDomainCreator( m_dataColumnNames.push_back("DataColumn"); m_weightsColumnNames.push_back("WeightsColumn"); for (size_t i = 1; i < nDataColumns; ++i) { - auto si = "_" + boost::lexical_cast<std::string>(i); + auto si = "_" + std::to_string(i); m_dataColumnNames.push_back(m_dataColumnNames.front() + si); m_weightsColumnNames.push_back(m_weightsColumnNames.front() + si); } diff --git a/Framework/CurveFitting/src/IFittingAlgorithm.cpp b/Framework/CurveFitting/src/IFittingAlgorithm.cpp index 9001b98bc90..eece7db63ac 100644 --- a/Framework/CurveFitting/src/IFittingAlgorithm.cpp +++ b/Framework/CurveFitting/src/IFittingAlgorithm.cpp @@ -144,8 +144,7 @@ void IFittingAlgorithm::setFunction() { m_workspacePropertyNames.resize(ndom); m_workspacePropertyNames[0] = "InputWorkspace"; for (size_t i = 1; i < ndom; ++i) { - std::string workspacePropertyName = - "InputWorkspace_" + boost::lexical_cast<std::string>(i); + std::string workspacePropertyName = "InputWorkspace_" + std::to_string(i); m_workspacePropertyNames[i] = workspacePropertyName; if (!existsProperty(workspacePropertyName)) { declareProperty( diff --git a/Framework/CurveFitting/src/MultiDomainCreator.cpp b/Framework/CurveFitting/src/MultiDomainCreator.cpp index f27cb25fb60..e1abe5f5dcb 100644 --- a/Framework/CurveFitting/src/MultiDomainCreator.cpp +++ b/Framework/CurveFitting/src/MultiDomainCreator.cpp @@ -136,8 +136,7 @@ boost::shared_ptr<API::Workspace> MultiDomainCreator::createOutputWorkspace( API::WorkspaceGroup_sptr(new API::WorkspaceGroup()); for (size_t i = 0; i < functions.size(); ++i) { - std::string localName = - baseName + "Workspace_" + boost::lexical_cast<std::string>(i); + std::string localName = baseName + "Workspace_" + std::to_string(i); auto fun = functions[i]; auto creator = m_creators[i]; boost::shared_ptr<API::FunctionDomain> localDomain; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h index e1bc5ab60e2..496e9b427be 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h @@ -484,7 +484,7 @@ void LoadEventNexus::loadEntryMetadata(const std::string &nexusfilename, T WS, std::vector<int> value; file.getData(value); if (!value.empty()) - run = boost::lexical_cast<std::string>(value[0]); + run = std::to_string(value[0]); } if (!run.empty()) { WS->mutableRun().addProperty("run_number", run); diff --git a/Framework/DataHandling/src/CreateSimulationWorkspace.cpp b/Framework/DataHandling/src/CreateSimulationWorkspace.cpp index ac1dfc8085c..e506a9db471 100644 --- a/Framework/DataHandling/src/CreateSimulationWorkspace.cpp +++ b/Framework/DataHandling/src/CreateSimulationWorkspace.cpp @@ -342,7 +342,7 @@ MantidVecPtr CreateSimulationWorkspace::createBinBoundaries() const { if (numBoundaries <= 2) { throw std::invalid_argument( "Error in BinParams - Gave invalid number of bin boundaries: " + - boost::lexical_cast<std::string>(numBoundaries)); + std::to_string(numBoundaries)); } return binsPtr; } diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 5662b5f8fed..2c2c7d87535 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -457,7 +457,7 @@ void GroupDetectors2::processFile(std::string fname, g_log.debug() << "Exception thrown: " << e.what() << std::endl; File.close(); std::string error(e.what() + std::string(" near line number ") + - boost::lexical_cast<std::string>(lineNum)); + std::to_string(lineNum)); if (File.fail()) { error = "Input output error while reading file "; } @@ -467,7 +467,7 @@ void GroupDetectors2::processFile(std::string fname, File.close(); std::string error(std::string("Problem reading integer value \"") + e.what() + std::string("\" near line number ") + - boost::lexical_cast<std::string>(lineNum)); + std::to_string(lineNum)); if (File.fail()) { error = "Input output error while reading file "; } @@ -816,10 +816,11 @@ void GroupDetectors2::readFile(spec2index_map &specs2index, std::istream &File, if (static_cast<int>(m_GroupWsInds[spectrumNo].size()) != numberOfSpectra) { // it makes no sense to continue reading the file, // we'll stop here - throw std::invalid_argument( - std::string("Bad number of spectra specification or spectra list " - "near line number ") + - boost::lexical_cast<std::string>(lineNum)); + throw std::invalid_argument( + std::string("Bad number of spectra " + "specification or spectra list " + "near line number ") + + std::to_string(lineNum)); } // make regular progress reports and check for a cancellation notification if ((m_GroupWsInds.size() % INTERVAL) == 1) { @@ -861,9 +862,8 @@ void GroupDetectors2::readSpectraIndexes(std::string line, g_log.debug() << name() << ": spectrum number " << spectrumNum << " refered to in the input file was not found in the " "input workspace\n"; - throw std::invalid_argument( - "Spectrum number " + boost::lexical_cast<std::string>(spectrumNum) + - " not found"); + throw std::invalid_argument("Spectrum number " + + std::to_string(spectrumNum) + " not found"); } if (unUsedSpec[ind->second] != USED) { // this array is used when the user // sets KeepUngroupedSpectra, as diff --git a/Framework/DataHandling/src/Load.cpp b/Framework/DataHandling/src/Load.cpp index 0088e1933ce..88b4e548d5f 100644 --- a/Framework/DataHandling/src/Load.cpp +++ b/Framework/DataHandling/src/Load.cpp @@ -414,7 +414,7 @@ void Load::loadMultipleFiles() { for (; childWsName != childWsNames.end(); ++childWsName, ++count) { Workspace_sptr childWs = group->getItem(*childWsName); const std::string childName = - group->getName() + "_" + boost::lexical_cast<std::string>(count); + group->getName() + "_" + std::to_string(count); API::AnalysisDataService::Instance().addOrReplace(childName, childWs); // childWs->setName(group->getName() + "_" + // boost::lexical_cast<std::string>(count)); @@ -444,7 +444,7 @@ void Load::loadMultipleFiles() { // child->setName(child->getName() + "_" + // boost::lexical_cast<std::string>(count)); const std::string childName = - child->getName() + "_" + boost::lexical_cast<std::string>(count); + child->getName() + "_" + std::to_string(count); API::AnalysisDataService::Instance().addOrReplace(childName, child); count++; } @@ -454,8 +454,7 @@ void Load::loadMultipleFiles() { count = 1; for (auto &childWsName : childWsNames) { Workspace_sptr childWs = group->getItem(childWsName); - std::string outWsPropName = - "OutputWorkspace_" + boost::lexical_cast<std::string>(count); + std::string outWsPropName = "OutputWorkspace_" + std::to_string(count); ++count; declareProperty(Kernel::make_unique<WorkspaceProperty<Workspace>>( outWsPropName, childWsName, Direction::Output)); diff --git a/Framework/DataHandling/src/LoadAscii2.cpp b/Framework/DataHandling/src/LoadAscii2.cpp index 487c780785d..d207973f2cd 100644 --- a/Framework/DataHandling/src/LoadAscii2.cpp +++ b/Framework/DataHandling/src/LoadAscii2.cpp @@ -135,7 +135,7 @@ void LoadAscii2::parseLine(const std::string &line, // there were more separators than there should have been, which isn't // right, or something went rather wrong throw std::runtime_error( - "Line " + boost::lexical_cast<std::string>(m_lineNo) + + "Line " + std::to_string(m_lineNo) + ": Sets of values must have between 1 and 3 delimiters"); } else if (cols == 1) { // a size of 1 is a spectra ID as long as there are no alphabetic @@ -151,7 +151,7 @@ void LoadAscii2::parseLine(const std::string &line, // if not then they've ommitted IDs in the the file previously and just // decided to include one (which is wrong and confuses everything) throw std::runtime_error( - "Line " + boost::lexical_cast<std::string>(m_lineNo) + + "Line " + std::to_string(m_lineNo) + ": Inconsistent inclusion of spectra IDs. All spectra must have " "IDs or all spectra must not have IDs. " "Check for blank lines, as they symbolize the end of one spectra " @@ -168,7 +168,7 @@ void LoadAscii2::parseLine(const std::string &line, } } else if (badLine(line)) { throw std::runtime_error( - "Line " + boost::lexical_cast<std::string>(m_lineNo) + + "Line " + std::to_string(m_lineNo) + ": Unexpected character found at beginning of line. Lines must either " "be a single integer, a list of numeric values, blank, or a text line " "beginning with the specified comment indicator: " + @@ -176,7 +176,7 @@ void LoadAscii2::parseLine(const std::string &line, } else { // strictly speaking this should never be hit, but just being sure throw std::runtime_error( - "Line " + boost::lexical_cast<std::string>(m_lineNo) + + "Line " + std::to_string(m_lineNo) + ": Unknown format at line. Lines must either be a single integer, a " "list of numeric values, blank, or a text line beginning with the " "specified comment indicator: " + @@ -257,7 +257,7 @@ void LoadAscii2::setcolumns(std::ifstream &file, std::string &line, // isn't right, or something went rather wrong throw std::runtime_error( "Sets of values must have between 1 and 3 delimiters. Found " + - boost::lexical_cast<std::string>(cols) + "."); + std::to_string(cols) + "."); } else if (cols != 1) { try { fillInputValues(values, columns); diff --git a/Framework/DataHandling/src/LoadDetectorInfo.cpp b/Framework/DataHandling/src/LoadDetectorInfo.cpp index 8c4601b0bbc..b337e626417 100644 --- a/Framework/DataHandling/src/LoadDetectorInfo.cpp +++ b/Framework/DataHandling/src/LoadDetectorInfo.cpp @@ -177,8 +177,7 @@ void LoadDetectorInfo::loadFromRAW(const std::string &filename) { } else { throw std::invalid_argument( "RAW file contains unexpected number of user tables=" + - boost::lexical_cast<std::string>(numUserTables) + - ". Expected 10 or 14."); + std::to_string(numUserTables) + ". Expected 10 or 14."); } // Is ut01 (=phi) present? Sometimes an array is present but has wrong values diff --git a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp index 4e2b40b4fdb..ed56d6b9c59 100644 --- a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp +++ b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp @@ -147,7 +147,7 @@ void LoadDetectorsGroupingFile::exec() { std::map<int, std::string> groupNamesMap = loader.getGroupNamesMap(); for (auto &group : groupNamesMap) { - std::string groupIdStr = boost::lexical_cast<std::string>(group.first); + std::string groupIdStr = std::to_string(first); m_groupWS->mutableRun().addProperty("GroupName_" + groupIdStr, group.second); } diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index 05bb881ec10..d6a741acf73 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -2690,8 +2690,8 @@ void LoadEventNexus::loadTimeOfFlight(EventWorkspaceCollection_sptr WS, } if (time_channels_number > 0) // the numbers start with 1 { - m_file->openGroup("time_channels_" + boost::lexical_cast<std::string>( - time_channels_number), + m_file->openGroup("time_channels_" + + std::to_string(time_channels_number), "IXtime_channels"); entries = m_file->getEntries(); for (string_map_t::const_iterator it = entries.begin(); diff --git a/Framework/DataHandling/src/LoadFITS.cpp b/Framework/DataHandling/src/LoadFITS.cpp index b4ebe91098b..798f1237026 100644 --- a/Framework/DataHandling/src/LoadFITS.cpp +++ b/Framework/DataHandling/src/LoadFITS.cpp @@ -245,7 +245,7 @@ void LoadFITS::loadHeader(const std::string &filePath, FITSInfo &header) { "bits per pixel as allowed in the FITS standard. The header of " "file '" + filePath + "' says that its bit depth is: " + - boost::lexical_cast<std::string>(header.bitsPerPixel)); + std::to_string(header.bitsPerPixel)); } catch (std::exception &e) { throw std::runtime_error( "Failed to process the '" + m_headerBitDepthKey + @@ -445,12 +445,11 @@ void LoadFITS::doLoadFiles(const std::vector<std::string> &paths, for (int i = 0; i < headers[0].numberOfAxis; ++i) { if (0 != (headers[0].axisPixelLengths[i] % binSize)) { throw std::runtime_error( - "Cannot rebin this image in blocks of " + - boost::lexical_cast<std::string>(binSize) + " x " + - boost::lexical_cast<std::string>(binSize) + + "Cannot rebin this image in blocks of " + std::to_string(binSize) + + " x " + std::to_string(binSize) + " pixels as requested because the size of dimension " + - boost::lexical_cast<std::string>(i + 1) + " (" + - boost::lexical_cast<std::string>(headers[0].axisPixelLengths[i]) + + std::to_string(i + 1) + " (" + + std::to_string(headers[0].axisPixelLengths[i]) + ") is not a multiple of the bin size."); } } @@ -467,7 +466,7 @@ void LoadFITS::doLoadFiles(const std::vector<std::string> &paths, } catch (std::exception &) { throw std::runtime_error( "Could not allocate enough memory to run when trying to allocate " + - boost::lexical_cast<std::string>(bytes) + " bytes."); + std::to_string(bytes) + " bytes."); } // Create a group for these new workspaces, if the group already exists, add @@ -536,8 +535,8 @@ void LoadFITS::doLoadFiles(const std::vector<std::string> &paths, imgWS = makeWorkspace(headers[i], fileNumberInGroup, buffer, imageY, imageE, imgWS, loadAsRectImg, binSize, noiseThresh); - progress.report("Loaded file " + boost::lexical_cast<std::string>(i + 1) + - " of " + boost::lexical_cast<std::string>(totalWS)); + progress.report("Loaded file " + std::to_string(i + 1) + " of " + + std::to_string(totalWS)); wsGroup->addWorkspace(imgWS); } @@ -979,8 +978,8 @@ void LoadFITS::readInBuffer(const FITSInfo &fileInfo, std::vector<char> &buffer, if (!file) { throw std::runtime_error( "Error while reading file: " + filename + ". Tried to read " + - boost::lexical_cast<std::string>(len) + " bytes but got " + - boost::lexical_cast<std::string>(file.gcount()) + + std::to_string(len) + " bytes but got " + + std::to_string(file.gcount()) + " bytes. The file and/or its headers may be wrong."); } // all is loaded diff --git a/Framework/DataHandling/src/LoadHelper.cpp b/Framework/DataHandling/src/LoadHelper.cpp index cc37ea98091..089ef2e315f 100644 --- a/Framework/DataHandling/src/LoadHelper.cpp +++ b/Framework/DataHandling/src/LoadHelper.cpp @@ -347,9 +347,9 @@ void LoadHelper::recurseAndAddNexusFieldsToWsRun(NXhandle nxfileID, property_double_value = (reinterpret_cast<double *>(dataBuffer))[dim_index]; } - std::string indexed_property_name = - property_name + std::string("_") + - boost::lexical_cast<std::string>(dim_index); + std::string indexed_property_name = property_name + + std::string("_") + + std::to_string(dim_index); if (units_status != NX_ERROR) runDetails.addProperty(indexed_property_name, property_double_value, diff --git a/Framework/DataHandling/src/LoadILLIndirect.cpp b/Framework/DataHandling/src/LoadILLIndirect.cpp index be1f763f188..799c32351f8 100644 --- a/Framework/DataHandling/src/LoadILLIndirect.cpp +++ b/Framework/DataHandling/src/LoadILLIndirect.cpp @@ -400,7 +400,7 @@ void LoadILLIndirect::moveSingleDetectors() { std::string prefix("single_tube_"); for (int i = 1; i <= 8; i++) { - std::string componentName = prefix + boost::lexical_cast<std::string>(i); + std::string componentName = prefix + std::to_string(i); moveComponent(componentName, i * 20.0, 2.0 + i / 10.0); } diff --git a/Framework/DataHandling/src/LoadILLSANS.cpp b/Framework/DataHandling/src/LoadILLSANS.cpp index 77d4cabaf60..5fc31603acb 100644 --- a/Framework/DataHandling/src/LoadILLSANS.cpp +++ b/Framework/DataHandling/src/LoadILLSANS.cpp @@ -534,7 +534,7 @@ void LoadILLSANS::loadMetaData(const NeXus::NXEntry &entry, API::Run &runDetails = m_localWorkspace->mutableRun(); int runNum = entry.getInt("run_number"); - std::string run_num = boost::lexical_cast<std::string>(runNum); + std::string run_num = std::to_string(runNum); runDetails.addProperty("run_number", run_num); if (entry.getFloat("mode") == 0.0) { // Not TOF diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp index b1be105a43a..081618879e9 100644 --- a/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -511,7 +511,7 @@ bool LoadISISNexus2::checkOptionalProperties(bool bseparateMonitors, std::string err = "Inconsistent range property. SpectrumMax is larger than number of " "spectra: " + - boost::lexical_cast<std::string>(m_loadBlockInfo.getMaxSpectrumID()); + std::to_string(m_loadBlockInfo.getMaxSpectrumID()); throw std::invalid_argument(err); } @@ -519,10 +519,9 @@ bool LoadISISNexus2::checkOptionalProperties(bool bseparateMonitors, m_entrynumber = getProperty("EntryNumber"); if (static_cast<int>(m_entrynumber) > m_loadBlockInfo.getNumberOfPeriods() || m_entrynumber < 0) { - std::string err = - "Invalid entry number entered. File contains " + - boost::lexical_cast<std::string>(m_loadBlockInfo.getNumberOfPeriods()) + - " period. "; + std::string err = "Invalid entry number entered. File contains " + + std::to_string(m_loadBlockInfo.getNumberOfPeriods()) + + " period. "; throw std::invalid_argument(err); } @@ -971,8 +970,7 @@ void LoadISISNexus2::loadRunDetails( m_proton_charge = static_cast<double>(entry.getFloat("proton_charge")); runDetails.setProtonCharge(m_proton_charge); - std::string run_num = - boost::lexical_cast<std::string>(entry.getInt("run_number")); + std::string run_num = std::to_string(entry.getInt("run_number")); runDetails.addProperty("run_number", run_num); // diff --git a/Framework/DataHandling/src/LoadMLZ.cpp b/Framework/DataHandling/src/LoadMLZ.cpp index b7ae32f8a4b..479ca2c6fa2 100644 --- a/Framework/DataHandling/src/LoadMLZ.cpp +++ b/Framework/DataHandling/src/LoadMLZ.cpp @@ -313,8 +313,7 @@ void LoadMLZ::loadRunDetails(NXEntry &entry) { double ei = m_mlzloader.calculateEnergy(m_wavelength); runDetails.addProperty<double>("Ei", ei, true); // overwrite - std::string duration = - boost::lexical_cast<std::string>(entry.getInt("duration")); + std::string duration = std::to_string(entry.getInt("duration")); runDetails.addProperty("duration", duration); std::string mode = entry.getString("mode"); @@ -331,13 +330,13 @@ void LoadMLZ::loadRunDetails(NXEntry &entry) { runDetails.addProperty("temperature", temperature); } - std::string monitorCounts = boost::lexical_cast<std::string>(m_monitorCounts); + std::string monitorCounts = std::to_string(m_monitorCounts); runDetails.addProperty("monitor_counts", monitorCounts); std::string chopper_speed = boost::lexical_cast<std::string>(m_chopper_speed); runDetails.addProperty("chopper_speed", chopper_speed); - std::string chopper_ratio = boost::lexical_cast<std::string>(m_chopper_ratio); + std::string chopper_ratio = std::to_string(m_chopper_ratio); runDetails.addProperty("chopper_ratio", chopper_ratio); std::string channel_width = boost::lexical_cast<std::string>(m_channelWidth); diff --git a/Framework/DataHandling/src/LoadMcStas.cpp b/Framework/DataHandling/src/LoadMcStas.cpp index 09c603b72f7..e98ca675ef6 100644 --- a/Framework/DataHandling/src/LoadMcStas.cpp +++ b/Framework/DataHandling/src/LoadMcStas.cpp @@ -392,8 +392,7 @@ void LoadMcStas::readEventData( std::string nameOfGroupWS = getProperty("OutputWorkspace"); std::string nameUserSee = std::string("EventData_") + nameOfGroupWS; std::string extraProperty = - "Outputworkspace_dummy_" + - boost::lexical_cast<std::string>(m_countNumWorkspaceAdded); + "Outputworkspace_dummy_" + std::to_string(m_countNumWorkspaceAdded); declareProperty(Kernel::make_unique<WorkspaceProperty<Workspace>>( extraProperty, nameUserSee, Direction::Output)); setProperty(extraProperty, boost::static_pointer_cast<Workspace>(eventWS)); @@ -532,8 +531,7 @@ void LoadMcStas::readHistogramData( std::string nameOfGroupWS = getProperty("OutputWorkspace"); std::string nameUserSee = nameAttrValueTITLE + "_" + nameOfGroupWS; std::string extraProperty = - "Outputworkspace_dummy_" + - boost::lexical_cast<std::string>(m_countNumWorkspaceAdded); + "Outputworkspace_dummy_" + std::to_string(m_countNumWorkspaceAdded); declareProperty(Kernel::make_unique<WorkspaceProperty<Workspace>>( extraProperty, nameUserSee, Direction::Output)); setProperty(extraProperty, boost::static_pointer_cast<Workspace>(ws)); diff --git a/Framework/DataHandling/src/LoadMuonNexus1.cpp b/Framework/DataHandling/src/LoadMuonNexus1.cpp index 2afc6a59096..a8e2b897d3c 100644 --- a/Framework/DataHandling/src/LoadMuonNexus1.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus1.cpp @@ -113,7 +113,7 @@ void LoadMuonNexus1::exec() { } std::string run_num; try { - run_num = boost::lexical_cast<std::string>(nxRun.getInt("number")); + run_num = std::to_string(nxRun.getInt("number")); } catch (...) { } diff --git a/Framework/DataHandling/src/LoadMuonNexus2.cpp b/Framework/DataHandling/src/LoadMuonNexus2.cpp index 645aea1bd4d..50b4210a324 100644 --- a/Framework/DataHandling/src/LoadMuonNexus2.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus2.cpp @@ -349,8 +349,7 @@ void LoadMuonNexus2::loadLogs(API::MatrixWorkspace_sptr ws, NXEntry &entry, ws->setComment(entry.getString("notes")); } - std::string run_num = - boost::lexical_cast<std::string>(entry.getInt("run_number")); + std::string run_num = std::to_string(entry.getInt("run_number")); // The sample is left to delete the property ws->mutableRun().addLogData( new PropertyWithValue<std::string>("run_number", run_num)); diff --git a/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Framework/DataHandling/src/LoadNexusProcessed.cpp index 91b5eb73d74..7032b33dd71 100644 --- a/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -546,7 +546,7 @@ std::string LoadNexusProcessed::buildWorkspaceName(const std::string &name, int64_t wsIndex, bool commonStem) { std::string wsName; - std::string index = boost::lexical_cast<std::string>(wsIndex); + std::string index = std::to_string(wsIndex); // if we don't have a common stem then use name tag if (!commonStem) { @@ -587,7 +587,7 @@ void LoadNexusProcessed::correctForWorkspaceNameClash(std::string &wsName) { std::string wsIndex = ""; // dont use an index if there is no other // workspace if (i > 0) { - wsIndex = "_" + boost::lexical_cast<std::string>(i); + wsIndex = "_" + std::to_string(i); } bool wsExists = AnalysisDataService::Instance().doesExist(wsName + wsIndex); @@ -831,8 +831,7 @@ API::Workspace_sptr LoadNexusProcessed::loadTableEntry(NXEntry &entry) { int columnNumber = 1; do { - std::string dataSetName = - "column_" + boost::lexical_cast<std::string>(columnNumber); + std::string dataSetName = "column_" + std::to_string(columnNumber); NXInfo info = nx_tw.getDataSetInfo(dataSetName.c_str()); if (info.stat == NX_ERROR) { @@ -861,7 +860,7 @@ API::Workspace_sptr LoadNexusProcessed::loadTableEntry(NXEntry &entry) { loadNumericColumn<bool, bool>(nx_tw, dataSetName, workspace, "bool"); } else { throw std::logic_error("Column with Nexus data type " + - boost::lexical_cast<std::string>(info.type) + + std::to_string(info.type) + " cannot be loaded."); } } else if (info.rank == 2) { @@ -997,8 +996,7 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) { int numberPeaks = 0; std::vector<std::string> columnNames; do { - std::string str = - "column_" + boost::lexical_cast<std::string>(columnNumber); + std::string str = "column_" + std::to_string(columnNumber); NXInfo info = nx_tw.getDataSetInfo(str.c_str()); if (info.stat == NX_ERROR) { diff --git a/Framework/DataHandling/src/LoadQKK.cpp b/Framework/DataHandling/src/LoadQKK.cpp index a3c507f4761..98a10371211 100644 --- a/Framework/DataHandling/src/LoadQKK.cpp +++ b/Framework/DataHandling/src/LoadQKK.cpp @@ -95,9 +95,8 @@ void LoadQKK::exec() { size_t nx = hmm.dim2(); // third dimension size_t nHist = ny * nx; // number of spectra in the dataset if (nHist == 0) { - throw std::runtime_error("Error in data dimensions: " + - boost::lexical_cast<std::string>(ny) + " X " + - boost::lexical_cast<std::string>(nx)); + throw std::runtime_error("Error in data dimensions: " + std::to_string(ny) + + " X " + std::to_string(nx)); } // Set the workspace structure. The workspace will contain nHist spectra each diff --git a/Framework/DataHandling/src/LoadRKH.cpp b/Framework/DataHandling/src/LoadRKH.cpp index 3843f301f20..a137e1d1c59 100644 --- a/Framework/DataHandling/src/LoadRKH.cpp +++ b/Framework/DataHandling/src/LoadRKH.cpp @@ -492,7 +492,7 @@ const std::string LoadRKH::readUnit(const std::string &line) { // accepted. // cppcheck-suppress stlIfStrFind if (unit.find('(') != 0 || unit.find(')') != unit.size()) { - std::string qCode = boost::lexical_cast<std::string>(SaveRKH::Q_CODE); + std::string qCode = std::to_string(SaveRKH::Q_CODE); if (symbol == qCode && theQuantity == "q" && unit == "(1/Angstrom)") { // 6 q (1/Angstrom) is the synatx for // MomentumTransfer diff --git a/Framework/DataHandling/src/LoadRawHelper.cpp b/Framework/DataHandling/src/LoadRawHelper.cpp index 279ac71aede..17873668794 100644 --- a/Framework/DataHandling/src/LoadRawHelper.cpp +++ b/Framework/DataHandling/src/LoadRawHelper.cpp @@ -164,7 +164,7 @@ void LoadRawHelper::setProtonCharge(API::Run &run) { * @param run :: the workspace's run object */ void LoadRawHelper::setRunNumber(API::Run &run) { - std::string run_num = boost::lexical_cast<std::string>(isisRaw->r_number); + std::string run_num = std::to_string(isisRaw->r_number); run.addLogData(new PropertyWithValue<std::string>("run_number", run_num)); } /**reads workspace dimensions,number of periods etc from raw data diff --git a/Framework/DataHandling/src/LoadSavuTomoConfig.cpp b/Framework/DataHandling/src/LoadSavuTomoConfig.cpp index 393975429f8..ef25f88b45f 100644 --- a/Framework/DataHandling/src/LoadSavuTomoConfig.cpp +++ b/Framework/DataHandling/src/LoadSavuTomoConfig.cpp @@ -159,7 +159,7 @@ ITableWorkspace_sptr LoadSavuTomoConfig::loadFile(std::string &fname, for (size_t j = 0; j < pluginsLen; j++) { API::TableRow table = ws->appendRow(); - std::string entryIdx = boost::lexical_cast<std::string>(j); + std::string entryIdx = std::to_string(j); try { f->openGroup(entryIdx, "NXnote"); } catch (NeXus::Exception &e) { diff --git a/Framework/DataHandling/src/LoadTBL.cpp b/Framework/DataHandling/src/LoadTBL.cpp index be214455581..5e7b097d88b 100644 --- a/Framework/DataHandling/src/LoadTBL.cpp +++ b/Framework/DataHandling/src/LoadTBL.cpp @@ -176,10 +176,9 @@ void LoadTBL::csvParse(std::string line, std::vector<std::string> &cols, } if (cols.size() != expectedCommas + 1) { std::string message = "A line must contain " + - boost::lexical_cast<std::string>(expectedCommas) + + std::to_string(expectedCommas) + " cell-delimiting commas. Found " + - boost::lexical_cast<std::string>(cols.size() - 1) + - "."; + std::to_string(cols.size() - 1) + "."; throw std::length_error(message); } } @@ -209,10 +208,9 @@ size_t LoadTBL::getCells(std::string line, std::vector<std::string> &cols, boost::token_compress_off); } else if (found < expectedCommas) { // less than 16 means the line isn't properly formatted. So Throw - std::string message = "A line must contain " + - boost::lexical_cast<std::string>(expectedCommas) + - " cell-delimiting commas. Found " + - boost::lexical_cast<std::string>(found) + "."; + std::string message = + "A line must contain " + std::to_string(expectedCommas) + + " cell-delimiting commas. Found " + std::to_string(found) + "."; throw std::length_error(message); } else { // More than 16 will need further checks as more is only ok when pairs of @@ -222,10 +220,9 @@ size_t LoadTBL::getCells(std::string line, std::vector<std::string> &cols, // if we didn't find any quotes, then there are too many commas and we // definitely have too many delimiters if (quoteBounds.empty()) { - std::string message = "A line must contain " + - boost::lexical_cast<std::string>(expectedCommas) + - " cell-delimiting commas. Found " + - boost::lexical_cast<std::string>(found) + "."; + std::string message = + "A line must contain " + std::to_string(expectedCommas) + + " cell-delimiting commas. Found " + std::to_string(found) + "."; throw std::length_error(message); } // now go through and split it up manually. Throw if we find ourselves in @@ -243,10 +240,9 @@ size_t LoadTBL::getCells(std::string line, std::vector<std::string> &cols, boost::lexical_cast<std::string>("," + cols[i])); } } else if (cols.size() < expectedCommas) { - std::string message = "A line must contain " + - boost::lexical_cast<std::string>(expectedCommas) + - " cell-delimiting commas. Found " + - boost::lexical_cast<std::string>(found) + "."; + std::string message = + "A line must contain " + std::to_string(expectedCommas) + + " cell-delimiting commas. Found " + std::to_string(found) + "."; throw std::length_error(message); } } diff --git a/Framework/DataHandling/src/SaveAscii2.cpp b/Framework/DataHandling/src/SaveAscii2.cpp index 2e947f1c387..3e175acf58b 100644 --- a/Framework/DataHandling/src/SaveAscii2.cpp +++ b/Framework/DataHandling/src/SaveAscii2.cpp @@ -445,7 +445,7 @@ void SaveAscii2::populateSpectrumNumberMetaData() { const size_t nHist = m_ws->getNumberHistograms(); for (size_t i = 0; i < nHist; i++) { const auto specNum = m_ws->getSpectrum(i)->getSpectrumNo(); - const auto specNumStr = boost::lexical_cast<std::string>(specNum); + const auto specNumStr = std::to_string(specNum); spectrumNumbers.push_back(specNumStr); } m_metaDataMap["spectrumnumber"] = spectrumNumbers; diff --git a/Framework/DataHandling/src/SaveISISNexus.cpp b/Framework/DataHandling/src/SaveISISNexus.cpp index 80d87c73b24..dd489ada075 100644 --- a/Framework/DataHandling/src/SaveISISNexus.cpp +++ b/Framework/DataHandling/src/SaveISISNexus.cpp @@ -171,8 +171,7 @@ void SaveISISNexus::exec() { saveChar("title", m_isisRaw->r_title, 80); saveInt("good_frames", &m_isisRaw->rpb.r_goodfrm); - std::string experiment_identifier = - boost::lexical_cast<std::string>(m_isisRaw->rpb.r_prop); + std::string experiment_identifier = std::to_string(m_isisRaw->rpb.r_prop); saveChar("experiment_identifier", &experiment_identifier[0], static_cast<int>(experiment_identifier.size())); int tmp_int(0); diff --git a/Framework/DataHandling/src/SaveOpenGenieAscii.cpp b/Framework/DataHandling/src/SaveOpenGenieAscii.cpp index 36fc36d978d..75097639386 100644 --- a/Framework/DataHandling/src/SaveOpenGenieAscii.cpp +++ b/Framework/DataHandling/src/SaveOpenGenieAscii.cpp @@ -173,7 +173,7 @@ std::string SaveOpenGenieAscii::getAxisHeader(const std::string alpha, outStr += twospc + singleSpc + alpha + "\n"; outStr += fourspc + GXR + "\n"; outStr += fourspc + banknum + "\n"; - outStr += fourspc + boost::lexical_cast<std::string>(nBins) + "\n"; + outStr += fourspc + std::to_string(nBins) + "\n"; return outStr; } @@ -332,7 +332,7 @@ void SaveOpenGenieAscii::addNtc(const std::string fourspc, int nBins) { std::string ntc = "ntc"; outStr += (" \"" + ntc + "\"" + "\n" + fourspc + "Integer" + "\n" + fourspc + - boost::lexical_cast<std::string>(nBins) + "\n"); + std::to_string(nBins) + "\n"); logVector.push_back(outStr); } diff --git a/Framework/DataHandling/src/SaveSavuTomoConfig.cpp b/Framework/DataHandling/src/SaveSavuTomoConfig.cpp index 5071fa3569b..5e5a42fa7fa 100644 --- a/Framework/DataHandling/src/SaveSavuTomoConfig.cpp +++ b/Framework/DataHandling/src/SaveSavuTomoConfig.cpp @@ -181,8 +181,7 @@ void SaveSavuTomoConfig::saveFile( // std::string cite = w->cell<std::string>(ti, 3); // but in the file it goes as: data (params), id, name - nxFile.makeGroup(boost::lexical_cast<std::string>(procCount++), "NXnote", - true); + nxFile.makeGroup(std::to_string(procCount++), "NXnote", true); nxFile.writeData("data", params); nxFile.writeData("id", id); nxFile.writeData("name", name); diff --git a/Framework/DataObjects/src/PeaksWorkspace.cpp b/Framework/DataObjects/src/PeaksWorkspace.cpp index 29ae417492b..48d37e174cd 100644 --- a/Framework/DataObjects/src/PeaksWorkspace.cpp +++ b/Framework/DataObjects/src/PeaksWorkspace.cpp @@ -306,8 +306,8 @@ PeaksWorkspace::peakInfo(Kernel::V3D qFrame, bool labCoords) const { } if (hasOneRunNumber) { - std::pair<std::string, std::string> runn( - "RunNumber", " " + boost::lexical_cast<std::string>(runNum)); + std::pair<std::string, std::string> runn("RunNumber", + " " + std::to_string(runNum)); Result.push_back(runn); } @@ -321,7 +321,7 @@ PeaksWorkspace::peakInfo(Kernel::V3D qFrame, bool labCoords) const { Result.push_back(GRead); std::pair<std::string, std::string> SeqNum( - "Seq Num,1st=1", " " + boost::lexical_cast<std::string>(seqNum + 1)); + "Seq Num,1st=1", " " + std::to_string(seqNum + 1)); Result.push_back(SeqNum); oss << std::setw(12) << std::fixed << std::setprecision(3) @@ -352,11 +352,11 @@ PeaksWorkspace::peakInfo(Kernel::V3D qFrame, bool labCoords) const { oss.clear(); std::pair<std::string, std::string> row( - "Row", " " + boost::lexical_cast<std::string>(peak->getRow())); + "Row", " " + std::to_string(peak->getRow())); Result.push_back(row); std::pair<std::string, std::string> col( - "Col", " " + boost::lexical_cast<std::string>(peak->getCol())); + "Col", " " + std::to_string(peak->getCol())); Result.push_back(col); std::pair<std::string, std::string> bank("Bank", diff --git a/Framework/DataObjects/src/Workspace2D.cpp b/Framework/DataObjects/src/Workspace2D.cpp index b3acd6688f2..0af10bb6dbb 100644 --- a/Framework/DataObjects/src/Workspace2D.cpp +++ b/Framework/DataObjects/src/Workspace2D.cpp @@ -209,17 +209,17 @@ void Workspace2D::setImageYAndE(const API::MantidImage &imageY, throw std::runtime_error( std::string("To load an image into a workspace with one spectrum per " "row, then number of spectra (") + - boost::lexical_cast<std::string>(getNumberHistograms()) + + std::to_string(getNumberHistograms()) + ") needs to be equal to the height (rows) of the image (" + - boost::lexical_cast<std::string>(height) + ")"); + std::to_string(height) + ")"); if (width != blocksize()) throw std::runtime_error( std::string("To load an image into a workspace with one spectrum per " "row, then number of bins (") + - boost::lexical_cast<std::string>(blocksize()) + + std::to_string(blocksize()) + ") needs to be equal to the width (columns) of the image (" + - boost::lexical_cast<std::string>(width) + ")"); + std::to_string(width) + ")"); // one spectrum - one row PARALLEL_FOR_IF(parallelExecution) diff --git a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp index acf34a2b42f..09c5dfd1b37 100644 --- a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp +++ b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp @@ -247,14 +247,14 @@ std::string SymmetryElementRotationGenerator::determineSymbol( symbol += "-"; } - symbol += boost::lexical_cast<std::string>(operation.order()); + symbol += std::to_string(operation.order()); int translation = static_cast<int>(static_cast<double>(operation.order()) * Kernel::V3D(determineTranslation(operation)).norm()); if (translation != 0) { - symbol += boost::lexical_cast<std::string>(translation); + symbol += std::to_string(translation); } return symbol; diff --git a/Framework/Geometry/src/Instrument/ComponentHelper.cpp b/Framework/Geometry/src/Instrument/ComponentHelper.cpp index e3ac86ae5d1..ffc46c880af 100644 --- a/Framework/Geometry/src/Instrument/ComponentHelper.cpp +++ b/Framework/Geometry/src/Instrument/ComponentHelper.cpp @@ -43,7 +43,7 @@ void moveComponent(const IComponent &comp, ParameterMap &pmap, break; default: throw std::invalid_argument("moveComponent - Unknown positionType: " + - boost::lexical_cast<std::string>(positionType)); + std::to_string(positionType)); } // Then find the corresponding relative position @@ -89,7 +89,7 @@ void rotateComponent(const IComponent &comp, ParameterMap &pmap, newRot = Rot0 * rot; } else { throw std::invalid_argument("rotateComponent - Unknown rotType: " + - boost::lexical_cast<std::string>(rotType)); + std::to_string(rotType)); } // Add a parameter for the new rotation diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index c86ba288371..8415bf6fbc3 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -2841,8 +2841,7 @@ InstrumentDefinitionParser::convertLocationsElement( if (!name.empty()) { // Add name with appropriate numeric postfix - pLoc->setAttribute( - "name", name + boost::lexical_cast<std::string>(nameCountStart + i)); + pLoc->setAttribute("name", name + std::to_string(nameCountStart + i)); } // Copy values of all the attributes set diff --git a/Framework/Geometry/src/Instrument/ParameterMap.cpp b/Framework/Geometry/src/Instrument/ParameterMap.cpp index c1152cefe7a..48690b31e58 100644 --- a/Framework/Geometry/src/Instrument/ParameterMap.cpp +++ b/Framework/Geometry/src/Instrument/ParameterMap.cpp @@ -193,8 +193,8 @@ const std::string ParameterMap::diff(const ParameterMap &rhs, // Quick size check if (this->size() != rhs.size()) { return std::string("Number of parameters does not match: ") + - boost::lexical_cast<std::string>(this->size()) + " not equal to " + - boost::lexical_cast<std::string>(rhs.size()); + std::to_string(this->size()) + " not equal to " + + std::to_string(rhs.size()); } // Run this same loops as in operator== diff --git a/Framework/ICat/src/ICat3/ICat3Helper.cpp b/Framework/ICat/src/ICat3/ICat3Helper.cpp index a8acf7fc25a..c2a4e15fc94 100644 --- a/Framework/ICat/src/ICat3/ICat3Helper.cpp +++ b/Framework/ICat/src/ICat3/ICat3Helper.cpp @@ -83,7 +83,7 @@ void CICatHelper::saveInvestigations( for (citr = investigations.begin(); citr != investigations.end(); ++citr) { API::TableRow t = outputws->appendRow(); - std::string id = boost::lexical_cast<std::string>(*(*citr)->id); + std::string id = std::to_string(*(*citr)->id); savetoTableWorkspace(&id, t); savetoTableWorkspace((*citr)->facility, t); @@ -91,12 +91,10 @@ void CICatHelper::saveInvestigations( savetoTableWorkspace((*citr)->instrument, t); savetoTableWorkspace((*citr)->invParamValue, t); - std::string startDate = - boost::lexical_cast<std::string>(*(*citr)->invStartDate); + std::string startDate = std::to_string(*(*citr)->invStartDate); savetoTableWorkspace(&startDate, t); - std::string endDate = - boost::lexical_cast<std::string>(*(*citr)->invEndDate); + std::string endDate = std::to_string(*(*citr)->invEndDate); savetoTableWorkspace(&endDate, t); std::string sessionID = m_session->getSessionId(); diff --git a/Framework/ICat/src/ICat4/ICat4Catalog.cpp b/Framework/ICat/src/ICat4/ICat4Catalog.cpp index b55a271d52d..251a9ca044d 100644 --- a/Framework/ICat/src/ICat4/ICat4Catalog.cpp +++ b/Framework/ICat/src/ICat4/ICat4Catalog.cpp @@ -273,8 +273,8 @@ void ICat4Catalog::search(const CatalogSearchParam &inputs, // Modify the query to include correct SELECT and LIMIT clauses. query.insert(0, "SELECT DISTINCT inves"); - query.append(" LIMIT " + boost::lexical_cast<std::string>(offset) + "," + - boost::lexical_cast<std::string>(limit)); + query.append(" LIMIT " + std::to_string(offset) + "," + + std::to_string(limit)); ICATPortBindingProxy icat; setICATProxySettings(icat); @@ -585,8 +585,7 @@ const std::string ICat4Catalog::getFileLocation(const long long &fileID) { setICATProxySettings(icat); auto searchResults = - performSearch(icat, "Datafile[id = '" + - boost::lexical_cast<std::string>(fileID) + "']"); + performSearch(icat, "Datafile[id = '" + std::to_string(fileID) + "']"); auto datafile = dynamic_cast<ns1__datafile *>(searchResults.at(0)); if (datafile && datafile->location) @@ -609,9 +608,8 @@ const std::string ICat4Catalog::getDownloadURL(const long long &fileID) { // Set the REST features of the URL. std::string session = "sessionId=" + m_session->getSessionId(); - std::string datafile = - "&datafileIds=" + boost::lexical_cast<std::string>(fileID); - std::string outname = "&outname=" + boost::lexical_cast<std::string>(fileID); + std::string datafile = "&datafileIds=" + std::to_string(fileID); + std::string outname = "&outname=" + std::to_string(fileID); // Add all the REST pieces to the URL. url += ("getData?" + session + datafile + outname + "&zip=false"); @@ -642,8 +640,7 @@ ICat4Catalog::getUploadURL(const std::string &investigationID, std::string session = "sessionId=" + m_session->getSessionId(); std::string name = "&name=" + createFileName; std::string datasetId = - "&datasetId=" + - boost::lexical_cast<std::string>(getMantidDatasetId(investigationID)); + "&datasetId=" + std::to_string(getMantidDatasetId(investigationID)); std::string description = "&description=" + dataFileDescription; // Add pieces of URL together. @@ -772,7 +769,7 @@ std::string ICat4Catalog::bytesToString(int64_t &fileSize) { fileSize = fileSize / 1024; } - return boost::lexical_cast<std::string>(fileSize) + units.at(order); + return std::to_string(fileSize) + units.at(order); } /** diff --git a/Framework/Kernel/src/MultiFileNameParser.cpp b/Framework/Kernel/src/MultiFileNameParser.cpp index f3d767a5478..44f4792280a 100644 --- a/Framework/Kernel/src/MultiFileNameParser.cpp +++ b/Framework/Kernel/src/MultiFileNameParser.cpp @@ -694,14 +694,14 @@ std::string pad(unsigned int run, const std::string &instString) { InstrumentInfo instInfo = ConfigService::Instance().getInstrument(instString); std::string prefix = instInfo.filePrefix(run) + instInfo.delimiter(); unsigned int padLength = instInfo.zeroPadding(run); - std::string runStr = boost::lexical_cast<std::string>(run); + std::string runStr = std::to_string(run); if (runStr.size() < padLength) runStr.insert(0, padLength - runStr.size(), '0'); else if (padLength > 0 && runStr.size() > padLength) throw std::runtime_error( "Could not parse run number \"" + runStr + "\" since the instrument run number length required is " + - boost::lexical_cast<std::string>(padLength)); + std::to_string(padLength)); runStr.insert(0, prefix); return runStr; } @@ -773,10 +773,10 @@ std::string &accumulateString(std::string &output, output += "_and_"; if (runRange.first == runRange.second) - output += boost::lexical_cast<std::string>(runRange.first); + output += std::to_string(runRange.first); else - output += boost::lexical_cast<std::string>(runRange.first) + "_to_" + - boost::lexical_cast<std::string>(runRange.second); + output += std::to_string(runRange.first) + "_to_" + + std::to_string(runRange.second); return output; } diff --git a/Framework/Kernel/src/PropertyHistory.cpp b/Framework/Kernel/src/PropertyHistory.cpp index 7d729c39e97..187cf0216a8 100644 --- a/Framework/Kernel/src/PropertyHistory.cpp +++ b/Framework/Kernel/src/PropertyHistory.cpp @@ -60,9 +60,9 @@ bool PropertyHistory::isEmptyDefault() const { } // Empty values if (emptyValues.empty()) { - emptyValues.push_back(boost::lexical_cast<std::string>(EMPTY_INT())); + emptyValues.push_back(std::to_string(EMPTY_INT())); emptyValues.push_back(boost::lexical_cast<std::string>(EMPTY_DBL())); - emptyValues.push_back(boost::lexical_cast<std::string>(EMPTY_LONG())); + emptyValues.push_back(std::to_string(EMPTY_LONG())); } // If default, input, number type and matches empty value then return true diff --git a/Framework/Kernel/src/UnitConversion.cpp b/Framework/Kernel/src/UnitConversion.cpp index 8c9d536fa06..ba3b70496dc 100644 --- a/Framework/Kernel/src/UnitConversion.cpp +++ b/Framework/Kernel/src/UnitConversion.cpp @@ -115,7 +115,7 @@ double UnitConversion::convertViaTOF(Unit &srcUnit, Unit &destUnit, default: throw std::invalid_argument( "UnitConversion::convertViaTOF - Unknown emode " + - boost::lexical_cast<std::string>(emode)); + std::to_string(emode)); }; const double unused(0.0); diff --git a/Framework/LiveData/src/ADARA/ADARAPackets.cpp b/Framework/LiveData/src/ADARA/ADARAPackets.cpp index 94ac30e33e1..6ff60313ce5 100644 --- a/Framework/LiveData/src/ADARA/ADARAPackets.cpp +++ b/Framework/LiveData/src/ADARA/ADARAPackets.cpp @@ -570,13 +570,13 @@ BeamMonitorConfigPkt::BeamMonitorConfigPkt(const uint8_t *data, uint32_t len) if (m_version == 0x00 && m_payload_len != (sizeof(uint32_t) + (beamMonCount() * sectionSize))) { std::string msg("BeamMonitorConfig V0 packet is incorrect length: "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } else if (m_version > ADARA::PacketType::BEAM_MONITOR_CONFIG_VERSION && m_payload_len < (sizeof(uint32_t) + (beamMonCount() * sectionSize))) { std::string msg("Newer BeamMonitorConfig packet is too short: "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } } @@ -595,12 +595,12 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len) if (m_version == 0x00 && m_payload_len < sizeof(uint32_t)) { std::string msg("DetectorBankSets V0 packet is too short for Count! "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } else if (m_version > ADARA::PacketType::DETECTOR_BANK_SETS_VERSION && m_payload_len < sizeof(uint32_t)) { std::string msg("Newer DetectorBankSets packet is too short for Count! "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } @@ -638,15 +638,15 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len) m_payload_len < ((sectionOffset + baseSectionOffsetNoBanks) * sizeof(uint32_t))) { std::string msg("DetectorBankSets V0 packet: too short for Set "); - msg += boost::lexical_cast<std::string>(i + 1); + msg += std::to_string(i + 1); msg += " of "; - msg += boost::lexical_cast<std::string>(numSets); + msg += std::to_string(numSets); msg += " sectionOffset="; - msg += boost::lexical_cast<std::string>(sectionOffset); + msg += std::to_string(sectionOffset); msg += " baseSectionOffsetNoBanks="; - msg += boost::lexical_cast<std::string>(baseSectionOffsetNoBanks); + msg += std::to_string(baseSectionOffsetNoBanks); msg += " payload_len="; - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); delete[] m_sectionOffsets; m_sectionOffsets = nullptr; delete[] m_after_banks_offset; @@ -656,15 +656,15 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len) m_payload_len < ((sectionOffset + baseSectionOffsetNoBanks) * sizeof(uint32_t))) { std::string msg("Newer DetectorBankSets packet: too short for Set "); - msg += boost::lexical_cast<std::string>(i + 1); + msg += std::to_string(i + 1); msg += " of "; - msg += boost::lexical_cast<std::string>(numSets); + msg += std::to_string(numSets); msg += " sectionOffset="; - msg += boost::lexical_cast<std::string>(sectionOffset); + msg += std::to_string(sectionOffset); msg += " baseSectionOffsetNoBanks="; - msg += boost::lexical_cast<std::string>(baseSectionOffsetNoBanks); + msg += std::to_string(baseSectionOffsetNoBanks); msg += " payload_len="; - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); delete[] m_sectionOffsets; m_sectionOffsets = nullptr; delete[] m_after_banks_offset; @@ -687,13 +687,13 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len) if (m_version == 0x00 && m_payload_len < (sectionOffset * sizeof(uint32_t))) { std::string msg("DetectorBankSets V0 packet: overall too short "); msg += " numSets="; - msg += boost::lexical_cast<std::string>(numSets); + msg += std::to_string(numSets); msg += " baseSectionOffsetNoBanks="; - msg += boost::lexical_cast<std::string>(baseSectionOffsetNoBanks); + msg += std::to_string(baseSectionOffsetNoBanks); msg += " final sectionOffset="; - msg += boost::lexical_cast<std::string>(sectionOffset); + msg += std::to_string(sectionOffset); msg += " payload_len="; - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); delete[] m_sectionOffsets; m_sectionOffsets = nullptr; delete[] m_after_banks_offset; @@ -703,13 +703,13 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len) m_payload_len < (sectionOffset * sizeof(uint32_t))) { std::string msg("Newer DetectorBankSets packet: overall too short "); msg += " numSets="; - msg += boost::lexical_cast<std::string>(numSets); + msg += std::to_string(numSets); msg += " baseSectionOffsetNoBanks="; - msg += boost::lexical_cast<std::string>(baseSectionOffsetNoBanks); + msg += std::to_string(baseSectionOffsetNoBanks); msg += " final sectionOffset="; - msg += boost::lexical_cast<std::string>(sectionOffset); + msg += std::to_string(sectionOffset); msg += " payload_len="; - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); delete[] m_sectionOffsets; m_sectionOffsets = nullptr; delete[] m_after_banks_offset; @@ -788,24 +788,24 @@ VariableU32Pkt::VariableU32Pkt(const uint8_t *data, uint32_t len) m_fields(reinterpret_cast<const uint32_t *>(payload())) { if (m_version == 0x00 && m_payload_len != (4 * sizeof(uint32_t))) { std::string msg("VariableValue (U32) V0 packet is incorrect length: "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } else if (m_version > ADARA::PacketType::VAR_VALUE_U32_VERSION && m_payload_len < (4 * sizeof(uint32_t))) { std::string msg("Newer VariableValue (U32) packet is too short: "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } if (validate_status(status())) { std::string msg("VariableValue (U32) packet has invalid status: "); - msg += boost::lexical_cast<std::string>(status()); + msg += std::to_string(status()); throw invalid_packet(msg); } if (validate_severity(severity())) { std::string msg("VariableValue (U32) packet has invalid severity: "); - msg += boost::lexical_cast<std::string>(severity()); + msg += std::to_string(severity()); throw invalid_packet(msg); } } @@ -821,24 +821,24 @@ VariableDoublePkt::VariableDoublePkt(const uint8_t *data, uint32_t len) if (m_version == 0x00 && m_payload_len != (sizeof(double) + (3 * sizeof(uint32_t)))) { std::string msg("VariableValue (Double) V0 packet is incorrect length: "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } else if (m_version > ADARA::PacketType::VAR_VALUE_DOUBLE_VERSION && m_payload_len < (sizeof(double) + (3 * sizeof(uint32_t)))) { std::string msg("Newer VariableValue (Double) packet is too short: "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } if (validate_status(status())) { std::string msg("VariableValue (double) packet has invalid status: "); - msg += boost::lexical_cast<std::string>(status()); + msg += std::to_string(status()); throw invalid_packet(msg); } if (validate_severity(severity())) { std::string msg("VariableValue (double) packet has invalid severity: "); - msg += boost::lexical_cast<std::string>(severity()); + msg += std::to_string(severity()); throw invalid_packet(msg); } } @@ -855,41 +855,41 @@ VariableStringPkt::VariableStringPkt(const uint8_t *data, uint32_t len) if (m_version == 0x00 && m_payload_len < (4 * sizeof(uint32_t))) { std::string msg("VariableValue (String) V0 packet is too short "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } else if (m_version > ADARA::PacketType::VAR_VALUE_STRING_VERSION && m_payload_len < (4 * sizeof(uint32_t))) { std::string msg("Newer VariableValue (String) packet is too short "); - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } size = m_fields[3]; if (m_version == 0x00 && m_payload_len < (size + (4 * sizeof(uint32_t)))) { std::string msg("VariableValue (String) V0 packet has oversize string: "); - msg += boost::lexical_cast<std::string>(size); + msg += std::to_string(size); msg += " vs payload "; - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } else if (m_version > ADARA::PacketType::VAR_VALUE_STRING_VERSION && m_payload_len < (size + (4 * sizeof(uint32_t)))) { std::string msg( "Newer VariableValue (String) packet has oversize string: "); - msg += boost::lexical_cast<std::string>(size); + msg += std::to_string(size); msg += " vs payload "; - msg += boost::lexical_cast<std::string>(m_payload_len); + msg += std::to_string(m_payload_len); throw invalid_packet(msg); } if (validate_status(status())) { std::string msg("VariableValue (string) packet has invalid status: "); - msg += boost::lexical_cast<std::string>(status()); + msg += std::to_string(status()); throw invalid_packet(msg); } if (validate_severity(severity())) { std::string msg("VariableValue (string) packet has invalid severity: "); - msg += boost::lexical_cast<std::string>(severity()); + msg += std::to_string(severity()); throw invalid_packet(msg); } diff --git a/Framework/LiveData/src/ISISHistoDataListener.cpp b/Framework/LiveData/src/ISISHistoDataListener.cpp index 68df3d84676..45a9bd04456 100644 --- a/Framework/LiveData/src/ISISHistoDataListener.cpp +++ b/Framework/LiveData/src/ISISHistoDataListener.cpp @@ -308,9 +308,8 @@ void ISISHistoDataListener::setPeriods( m_periodList = periodList; if (*std::max_element(m_periodList.begin(), m_periodList.end()) > m_numberOfPeriods) { - throw std::invalid_argument( - "Invalid period(s) specified. Maximum " + - boost::lexical_cast<std::string>(m_numberOfPeriods)); + throw std::invalid_argument("Invalid period(s) specified. Maximum " + + std::to_string(m_numberOfPeriods)); } } } @@ -509,7 +508,7 @@ void ISISHistoDataListener::loadTimeRegimes() { // If there is nonzero number of time channels for the second one then we have // two regimes. for (size_t tr = 0; tr < 2; ++tr) { - const std::string regime = boost::lexical_cast<std::string>(tr + 1); + const std::string regime = std::to_string(tr + 1); // get number of bins in this regime int nbins = getInt(ntcPrefix + regime); if (nbins == 0) { @@ -559,8 +558,7 @@ void ISISHistoDataListener::loadTimeRegimes() { } const std::string detRTCB = - rtcbPrefix + "_" + - boost::lexical_cast<std::string>(m_monitorSpectra.front()); + rtcbPrefix + "_" + std::to_string(m_monitorSpectra.front()); // read in the bin boundaries getFloatArray(detRTCB, floatBuffer, nbins + 1); } @@ -610,7 +608,7 @@ int ISISHistoDataListener::getTimeRegimeToLoad() const { m_monitorSpectra.end(); if (!isMonitor && specIt > m_totalNumberOfSpectra) throw std::invalid_argument("Invalid spectra index is found: " + - boost::lexical_cast<std::string>(specIt)); + std::to_string(specIt)); int specRegime = isMonitor ? 1 : 0; if (regime < 0) { regime = specRegime; diff --git a/Framework/LiveData/src/ISISLiveEventDataListener.cpp b/Framework/LiveData/src/ISISLiveEventDataListener.cpp index bc476ebf3ff..3e5cb636434 100644 --- a/Framework/LiveData/src/ISISLiveEventDataListener.cpp +++ b/Framework/LiveData/src/ISISLiveEventDataListener.cpp @@ -343,7 +343,7 @@ void ISISLiveEventDataListener::initEventBuffer( // Set the run number m_runNumber = setup.head_setup.run_number; - std::string run_num = boost::lexical_cast<std::string>(m_runNumber); + std::string run_num = std::to_string(m_runNumber); m_eventBuffer[0]->mutableRun().addLogData( new Mantid::Kernel::PropertyWithValue<std::string>(RUN_NUMBER_PROPERTY, run_num)); diff --git a/Framework/LiveData/src/LoadLiveData.cpp b/Framework/LiveData/src/LoadLiveData.cpp index 8987625dbbf..9af1a6dde8e 100644 --- a/Framework/LiveData/src/LoadLiveData.cpp +++ b/Framework/LiveData/src/LoadLiveData.cpp @@ -560,8 +560,8 @@ void LoadLiveData::exec() { for (size_t i = 0; i < n; ++i) { auto ws = out_gws->getItem(i); std::string itemName = ws->name(); - std::string wsName = getPropertyValue("OutputWorkspace") + "_" + - boost::lexical_cast<std::string>(i + 1); + std::string wsName = + getPropertyValue("OutputWorkspace") + "_" + std::to_string(i + 1); if (wsName != itemName) { if (AnalysisDataService::Instance().doesExist(itemName)) { // replace the temporary name with the proper one diff --git a/Framework/MDAlgorithms/src/CompactMD.cpp b/Framework/MDAlgorithms/src/CompactMD.cpp index 9491595a25e..9d1a5382dee 100644 --- a/Framework/MDAlgorithms/src/CompactMD.cpp +++ b/Framework/MDAlgorithms/src/CompactMD.cpp @@ -135,8 +135,7 @@ void CompactMD::exec() { // setting property PxBin depending on the number of dimensions the // input workspace has. for (size_t iter = 0; iter < input_ws->getNumDims(); iter++) { - std::string propertyString = - "P" + boost::lexical_cast<std::string>(iter + 1) + "Bin"; + std::string propertyString = "P" + std::to_string(iter + 1) + "Bin"; cut_alg->setProperty(propertyString, pBinStrings[iter]); } cut_alg->execute(); diff --git a/Framework/MDAlgorithms/src/ConvertToMDParent.cpp b/Framework/MDAlgorithms/src/ConvertToMDParent.cpp index d7a3c5bd36a..8559fbc82f8 100644 --- a/Framework/MDAlgorithms/src/ConvertToMDParent.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMDParent.cpp @@ -314,9 +314,8 @@ ConvertToMDParent::preprocessDetectorsPositions( "ActualDetectorsNum"); for (uint32_t i = 0; i < NDetectors; i++) if (isNaN(*(eFixed + i))) - throw( - std::invalid_argument("Undefined eFixed energy for detector N: " + - boost::lexical_cast<std::string>(i))); + throw(std::invalid_argument( + "Undefined eFixed energy for detector N: " + std::to_string(i))); } } diff --git a/Framework/MDAlgorithms/src/CutMD.cpp b/Framework/MDAlgorithms/src/CutMD.cpp index 18caa5ded26..17c36724ffe 100644 --- a/Framework/MDAlgorithms/src/CutMD.cpp +++ b/Framework/MDAlgorithms/src/CutMD.cpp @@ -156,8 +156,7 @@ calculateSteps(const std::vector<MinMax> &inExtents, outExtents[i].first = dimMin; } else { - throw std::runtime_error("Cannot handle " + - boost::lexical_cast<std::string>(nArgs) + + throw std::runtime_error("Cannot handle " + std::to_string(nArgs) + " bins."); } if (outBin < 0) @@ -340,14 +339,14 @@ void CutMD::exec() { for (size_t i = 0; i < 5; ++i) { if (i < numDims && pbins[i].empty()) throw std::runtime_error( - "P" + boost::lexical_cast<std::string>(i + 1) + + "P" + std::to_string(i + 1) + "Bin must be set when processing a workspace with " + - boost::lexical_cast<std::string>(numDims) + " dimensions."); + std::to_string(numDims) + " dimensions."); if (i >= numDims && !pbins[i].empty()) throw std::runtime_error( - "P" + boost::lexical_cast<std::string>(i + 1) + + "P" + std::to_string(i + 1) + "Bin must NOT be set when processing a workspace with " + - boost::lexical_cast<std::string>(numDims) + " dimensions."); + std::to_string(numDims) + " dimensions."); } // Get extents in projection @@ -456,8 +455,7 @@ void CutMD::exec() { } const std::string value = label + ", " + unit + ", " + vecStr; - cutAlg->setProperty("BasisVector" + boost::lexical_cast<std::string>(i), - value); + cutAlg->setProperty("BasisVector" + std::to_string(i), value); } // Translate extents into a single vector diff --git a/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp b/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp index b808b65bb47..173a8188e1a 100644 --- a/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp +++ b/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp @@ -176,12 +176,11 @@ API::IMDEventWorkspace_sptr MDEventWSWrapper::createEmptyMDWS(const MDWSDescription &WSD) { if (WSD.nDimensions() < 1 || WSD.nDimensions() > MAX_N_DIM) { - std::string ERR = - " Number of requested MD dimensions: " + - boost::lexical_cast<std::string>(WSD.nDimensions()) + - " exceeds maximal number of MD dimensions: " + - boost::lexical_cast<std::string>(static_cast<int>(MAX_N_DIM)) + - " instantiated during compilation\n"; + std::string ERR = " Number of requested MD dimensions: " + + std::to_string(WSD.nDimensions()) + + " exceeds maximal number of MD dimensions: " + + std::to_string(static_cast<int>(MAX_N_DIM)) + + " instantiated during compilation\n"; throw(std::invalid_argument(ERR)); } diff --git a/Framework/MDAlgorithms/src/MDTransfModQ.cpp b/Framework/MDAlgorithms/src/MDTransfModQ.cpp index cded826702e..0acf11cf269 100644 --- a/Framework/MDAlgorithms/src/MDTransfModQ.cpp +++ b/Framework/MDAlgorithms/src/MDTransfModQ.cpp @@ -97,12 +97,10 @@ bool MDTransfModQ::calcGenericVariables(std::vector<coord_t> &Coord, // sanity check. If fails, something went fundamentally wrong if (m_NMatrixDim + m_AddDimCoordinates.size() != nd) { std::string ERR = - "Number of matrix dimensions: " + - boost::lexical_cast<std::string>(m_NMatrixDim) + + "Number of matrix dimensions: " + std::to_string(m_NMatrixDim) + " plus number of additional dimensions: " + - boost::lexical_cast<std::string>(m_AddDimCoordinates.size()) + - " not equal to number of workspace dimensions: " + - boost::lexical_cast<std::string>(nd); + std::to_string(m_AddDimCoordinates.size()) + + " not equal to number of workspace dimensions: " + std::to_string(nd); throw(std::invalid_argument(ERR)); } diff --git a/Framework/MDAlgorithms/src/MDTransfNoQ.cpp b/Framework/MDAlgorithms/src/MDTransfNoQ.cpp index aba7be62abe..1a58d4ab6cb 100644 --- a/Framework/MDAlgorithms/src/MDTransfNoQ.cpp +++ b/Framework/MDAlgorithms/src/MDTransfNoQ.cpp @@ -22,12 +22,10 @@ bool MDTransfNoQ::calcGenericVariables(std::vector<coord_t> &Coord, size_t nd) { // sanity check. If fails, something went fundamentally wrong if (m_NMatrixDim + m_AddDimCoordinates.size() != nd) { std::string ERR = - "Number of matrix dimensions: " + - boost::lexical_cast<std::string>(m_NMatrixDim) + + "Number of matrix dimensions: " + std::to_string(m_NMatrixDim) + " plus number of additional dimensions: " + - boost::lexical_cast<std::string>(m_AddDimCoordinates.size()) + - " not equal to number of workspace dimensions: " + - boost::lexical_cast<std::string>(nd); + std::to_string(m_AddDimCoordinates.size()) + + " not equal to number of workspace dimensions: " + std::to_string(nd); throw(std::invalid_argument(ERR)); } // if one axis is numeric, 1 coordinate came from workspace diff --git a/Framework/MDAlgorithms/src/MDWSDescription.cpp b/Framework/MDAlgorithms/src/MDWSDescription.cpp index 5a2b2070ced..4caed18d9be 100644 --- a/Framework/MDAlgorithms/src/MDWSDescription.cpp +++ b/Framework/MDAlgorithms/src/MDWSDescription.cpp @@ -21,10 +21,9 @@ namespace MDAlgorithms { */ void MDWSDescription::setDimName(unsigned int nDim, const std::string &Name) { if (nDim >= m_NDims) { - std::string ERR = "setDimName::Dimension index: " + - boost::lexical_cast<std::string>(nDim) + + std::string ERR = "setDimName::Dimension index: " + std::to_string(nDim) + " out of total dimensions range: " + - boost::lexical_cast<std::string>(m_NDims); + std::to_string(m_NDims); throw(std::invalid_argument(ERR)); } m_DimNames[nDim] = Name; @@ -35,10 +34,9 @@ void MDWSDescription::setDimName(unsigned int nDim, const std::string &Name) { *along axis and have nothing in common with units, defined by unit factory */ void MDWSDescription::setDimUnit(unsigned int nDim, const std::string &Unit) { if (nDim >= m_NDims) { - std::string ERR = "setDimUnit::Dimension index: " + - boost::lexical_cast<std::string>(nDim) + + std::string ERR = "setDimUnit::Dimension index: " + std::to_string(nDim) + " out of total dimensions range: " + - boost::lexical_cast<std::string>(m_NDims); + std::to_string(m_NDims); throw(std::invalid_argument(ERR)); } m_DimUnits[nDim] = Unit; @@ -210,9 +208,8 @@ void MDWSDescription::checkWSCorresponsMDWorkspace( if (m_NDims != NewMDWorkspaceD.m_NDims) { std::string ERR = "Dimension numbers are inconsistent: this workspace has " + - boost::lexical_cast<std::string>(m_NDims) + - " dimensions and target one: " + - boost::lexical_cast<std::string>(NewMDWorkspaceD.m_NDims); + std::to_string(m_NDims) + " dimensions and target one: " + + std::to_string(NewMDWorkspaceD.m_NDims); throw(std::invalid_argument(ERR)); } @@ -264,8 +261,8 @@ void MDWSDescription::resizeDimDescriptions(unsigned int nDimensions, m_NBins.assign(m_NDims, nBins); for (size_t i = 0; i < m_NDims; i++) { - m_DimIDs[i] = m_DimIDs[i] + boost::lexical_cast<std::string>(i); - m_DimNames[i] = m_DimNames[i] + boost::lexical_cast<std::string>(i); + m_DimIDs[i] = m_DimIDs[i] + std::to_string(i); + m_DimNames[i] = m_DimNames[i] + std::to_string(i); } } /**function sets number of bins each dimension become split @@ -278,11 +275,10 @@ void MDWSDescription::setNumBins(const std::vector<int> &nBins_toSplit) { if (!(nBins_toSplit.size() == 1 || nBins_toSplit.size() == this->m_NDims)) throw std::invalid_argument( - " Number of dimensions: " + - boost::lexical_cast<std::string>(nBins_toSplit.size()) + + " Number of dimensions: " + std::to_string(nBins_toSplit.size()) + " defining number of bins to split into is not equal to total number " "of dimensions: " + - boost::lexical_cast<std::string>(this->m_NDims)); + std::to_string(this->m_NDims)); this->m_NBins.resize(this->m_NDims); @@ -383,20 +379,19 @@ void MDWSDescription::checkMinMaxNdimConsistent( const std::vector<double> &minVal, const std::vector<double> &maxVal) { if (minVal.size() != maxVal.size()) { std::string ERR = " number of specified min dimension values: " + - boost::lexical_cast<std::string>(minVal.size()) + + std::to_string(minVal.size()) + " and number of max values: " + - boost::lexical_cast<std::string>(maxVal.size()) + - " are not consistent\n"; + std::to_string(maxVal.size()) + " are not consistent\n"; throw(std::invalid_argument(ERR)); } for (size_t i = 0; i < minVal.size(); i++) { if (maxVal[i] <= minVal[i]) { - std::string ERR = - " min value " + boost::lexical_cast<std::string>(minVal[i]) + - " not less then max value" + - boost::lexical_cast<std::string>(maxVal[i]) + " in direction: " + - boost::lexical_cast<std::string>(i) + "\n"; + std::string ERR = " min value " + + boost::lexical_cast<std::string>(minVal[i]) + + " not less then max value" + + boost::lexical_cast<std::string>(maxVal[i]) + + " in direction: " + std::to_string(i) + "\n"; throw(std::invalid_argument(ERR)); } } diff --git a/Framework/MDAlgorithms/src/Quantification/CachedExperimentInfo.cpp b/Framework/MDAlgorithms/src/Quantification/CachedExperimentInfo.cpp index 254cc95e551..ed66d421953 100644 --- a/Framework/MDAlgorithms/src/Quantification/CachedExperimentInfo.cpp +++ b/Framework/MDAlgorithms/src/Quantification/CachedExperimentInfo.cpp @@ -182,7 +182,7 @@ void CachedExperimentInfo::initCaches( throw std::invalid_argument("CachedExperimentInfo::initCaches - Detector " "has no bounding box, cannot sample from it. " "ID:" + - boost::lexical_cast<std::string>(det->getID())); + std::to_string(det->getID())); } constexpr double rad2deg = 180. / M_PI; diff --git a/Framework/MDAlgorithms/src/Quantification/Models/QCoordinate.cpp b/Framework/MDAlgorithms/src/Quantification/Models/QCoordinate.cpp index 931360cf86e..11664c0d376 100644 --- a/Framework/MDAlgorithms/src/Quantification/Models/QCoordinate.cpp +++ b/Framework/MDAlgorithms/src/Quantification/Models/QCoordinate.cpp @@ -139,7 +139,7 @@ QCoordinate::scatteringIntensity(const API::ExperimentInfo &exptSetup, twoPiDet; else throw std::invalid_argument("Logical error. Invalid coord type " + - boost::lexical_cast<std::string>(m_coord)); + std::to_string(m_coord)); } } } diff --git a/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp b/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp index 318a6e451ab..1202cdb98d3 100644 --- a/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp +++ b/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp @@ -261,7 +261,7 @@ void TobyFitResolutionModel::setAttribute( throw std::invalid_argument("TobyFitResolutionModel: Invalid MCType " "argument, valid values are 0-4. Current " "value=" + - boost::lexical_cast<std::string>(m_mcType)); + std::to_string(m_mcType)); } } else if (name == CRYSTAL_MOSAIC) { m_mosaicActive = (value.asInt() != 0); diff --git a/Framework/MDAlgorithms/src/UserFunctionMD.cpp b/Framework/MDAlgorithms/src/UserFunctionMD.cpp index a51b75fb416..d1051be56cf 100644 --- a/Framework/MDAlgorithms/src/UserFunctionMD.cpp +++ b/Framework/MDAlgorithms/src/UserFunctionMD.cpp @@ -65,7 +65,7 @@ void UserFunctionMD::initDimensions() { m_vars.resize(m_dimensionIndexMap.size()); m_varNames.resize(m_dimensionIndexMap.size()); for (size_t i = 0; i < m_vars.size(); ++i) { - m_varNames[i] = "x" + boost::lexical_cast<std::string>(i); + m_varNames[i] = "x" + std::to_string(i); m_parser.DefineVar(m_varNames[i], &m_vars[i]); } } diff --git a/Framework/Nexus/src/NexusFileIO.cpp b/Framework/Nexus/src/NexusFileIO.cpp index 74d3fc61ce0..c390c7430cd 100644 --- a/Framework/Nexus/src/NexusFileIO.cpp +++ b/Framework/Nexus/src/NexusFileIO.cpp @@ -636,7 +636,7 @@ int NexusFileIO::writeNexusTableWorkspace( for (size_t i = 0; i < itableworkspace->columnCount(); i++) { Column_const_sptr col = itableworkspace->getColumn(i); - std::string str = "column_" + boost::lexical_cast<std::string>(i + 1); + std::string str = "column_" + std::to_string(i + 1); if (col->isType<double>()) { writeTableColumn<double, double>(NX_FLOAT64, "", *col, str); diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp index 3d221c8fd65..9d4e5837f49 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp @@ -117,8 +117,8 @@ void throwIfSizeIncorrect(IMDHistoWorkspace &self, const numeric::array &signal, int arrDim = extract<int>(arrShape[i])(); if (wsShape[i] != arrDim) { std::ostringstream os; - os << fnLabel << ": The dimension size for the " - << boost::lexical_cast<std::string>(i) << "th dimension do not match. " + os << fnLabel << ": The dimension size for the " << std::to_string(i) + << "th dimension do not match. " << "Workspace dimension size=" << wsShape[i] << ", array size=" << arrDim; throw std::invalid_argument(os.str()); diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp index 3fbd558178c..77b6f7357f6 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp @@ -280,7 +280,7 @@ void addRowFromDict(ITableWorkspace &self, const bpl::dict &rowItems) { throw std::invalid_argument( "Number of values given does not match the number of columns. " "Expected: " + - boost::lexical_cast<std::string>(self.columnCount())); + std::to_string(self.columnCount())); } // Add a new row to populate with values @@ -340,7 +340,7 @@ void addRowFromSequence(ITableWorkspace &self, const bpl::object &rowItems) { throw std::invalid_argument( "Number of values given does not match the number of columns. " "Expected: " + - boost::lexical_cast<std::string>(self.columnCount())); + std::to_string(self.columnCount())); } // Add a new row to populate with values diff --git a/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp index 737e5137170..c8e1d7fd9d7 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp @@ -61,7 +61,7 @@ void setSpectrumFromPyObject(MatrixWorkspace &self, data_modifier accessor, if (boost::python::len(shape) != 1) { throw std::invalid_argument( "Invalid shape for setting 1D spectrum array, array is " + - boost::lexical_cast<std::string>(boost::python::len(shape)) + "D"); + std::to_string(boost::python::len(shape)) + "D"); } const size_t pyArrayLength = boost::python::extract<size_t>(shape[0]); Mantid::MantidVec &wsArrayRef = (self.*accessor)(wsIndex); @@ -70,8 +70,8 @@ void setSpectrumFromPyObject(MatrixWorkspace &self, data_modifier accessor, if (pyArrayLength != wsArrayLength) { throw std::invalid_argument( "Length mismatch between workspace array & python array. ws=" + - boost::lexical_cast<std::string>(wsArrayLength) + ", python=" + - boost::lexical_cast<std::string>(pyArrayLength)); + std::to_string(wsArrayLength) + ", python=" + + std::to_string(pyArrayLength)); } for (size_t i = 0; i < wsArrayLength; ++i) { wsArrayRef[i] = extract<double>(values[i]); diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp index 29b48de8208..d8c5697b11a 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp @@ -23,10 +23,9 @@ VMD_t getItem(VMD &self, const size_t index) { if (index < self.getNumDims()) { return self[index]; } else - throw std::out_of_range( - "VMD index out of range. index=" + - boost::lexical_cast<std::string>(index) + ", len=" + - boost::lexical_cast<std::string>(self.getNumDims())); + throw std::out_of_range("VMD index out of range. index=" + + std::to_string(index) + ", len=" + + std::to_string(self.getNumDims())); } /** @@ -40,10 +39,9 @@ void setItem(VMD &self, const size_t index, const VMD_t value) { if (index < self.getNumDims()) { self[index] = value; } else - throw std::out_of_range( - "VMD index out of range. index=" + - boost::lexical_cast<std::string>(index) + ", len=" + - boost::lexical_cast<std::string>(self.getNumDims())); + throw std::out_of_range("VMD index out of range. index=" + + std::to_string(index) + ", len=" + + std::to_string(self.getNumDims())); } } diff --git a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp index 1c087ac8dc9..416d0241a10 100644 --- a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp +++ b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp @@ -1040,8 +1040,7 @@ std::string SCARFTomoReconstruction::buildSubmitBody( // <AppParam><id>JOB_NAME</id><value>foo</value><type></type></AppParam> std::string name; if (jobName.empty()) { - name = - "Mantid_tomography_" + boost::lexical_cast<std::string>(jobSeqNo()); + name = "Mantid_tomography_" + std::to_string(jobSeqNo()); } else { name = jobName; } @@ -1183,7 +1182,7 @@ void SCARFTomoReconstruction::genOutputStatusInfo( jobs->item(static_cast<unsigned long>(i))); if (!el) throw std::runtime_error("Error while trying to parse job with index " + - boost::lexical_cast<std::string>(i) + + std::to_string(i) + "could not produce a complete table workspace."); Poco::XML::Element *id = el->getChildElement("id"); @@ -1464,8 +1463,7 @@ void SCARFTomoReconstruction::getAllJobFiles(const std::string &jobId, "existing jobs, username, and parameters."); } - progress(1.0, "Download of " + - boost::lexical_cast<std::string>(filePACNames.size()) + + progress(1.0, "Download of " + std::to_string(filePACNames.size()) + " file(s) completed in " + localDir); } diff --git a/Framework/RemoteJobManagers/src/LSFJobManager.cpp b/Framework/RemoteJobManagers/src/LSFJobManager.cpp index f98c974e705..65c97f15222 100644 --- a/Framework/RemoteJobManagers/src/LSFJobManager.cpp +++ b/Framework/RemoteJobManagers/src/LSFJobManager.cpp @@ -416,8 +416,7 @@ std::string LSFJobManager::startRemoteTransaction() { } size_t idx = g_transactions.size(); - std::string tid = - std::string("LSFTrans_") + boost::lexical_cast<std::string>(idx + 1); + std::string tid = std::string("LSFTrans_") + std::to_string(idx + 1); auto ret = g_transactions.insert( std::pair<std::string, Transaction>(tid, LSFJobManager::Transaction())); @@ -793,7 +792,7 @@ LSFJobManager::genOutputStatusInfo(const std::string &resp, jobs->item(static_cast<unsigned long>(i))); if (!el) throw std::runtime_error("Error while trying to parse job with index " + - boost::lexical_cast<std::string>(i) + + std::to_string(i) + "could not produce a complete table workspace."); info.push_back(RemoteJobInfo()); @@ -949,7 +948,7 @@ std::string LSFJobManager::buildSubmitBody( // <AppParam><id>JOB_NAME</id><value>foo</value><type></type></AppParam> std::string name; if (jobName.empty()) { - name = "Mantid_job_" + boost::lexical_cast<std::string>(seqNo()); + name = "Mantid_job_" + std::to_string(seqNo()); } else { name = jobName; } @@ -976,12 +975,11 @@ std::string LSFJobManager::buildSubmitBody( // <AppParam><id>MIN_NUM_CPU</id><value>1</value><type></type></AppParam> if (0 != numNodes) { encodeParam(body, boundaryInner, "MIN_NUM_CPU", "1"); - encodeParam(body, boundaryInner, "MAX_NUM_CPU", - boost::lexical_cast<std::string>(numNodes)); + encodeParam(body, boundaryInner, "MAX_NUM_CPU", std::to_string(numNodes)); } if (0 != coresPerNode) { encodeParam(body, boundaryInner, "PROC_PRE_HOST", - boost::lexical_cast<std::string>(coresPerNode)); + std::to_string(coresPerNode)); } } diff --git a/Framework/RemoteJobManagers/src/MantidWebServiceAPIJobManager.cpp b/Framework/RemoteJobManagers/src/MantidWebServiceAPIJobManager.cpp index d9fbd93802c..f0bfea785ac 100644 --- a/Framework/RemoteJobManagers/src/MantidWebServiceAPIJobManager.cpp +++ b/Framework/RemoteJobManagers/src/MantidWebServiceAPIJobManager.cpp @@ -415,8 +415,8 @@ std::string MantidWebServiceAPIJobManager::submitRemoteJob( MantidWebServiceAPIHelper::PostDataMap postData; postData["TransID"] = transactionID; - postData["NumNodes"] = boost::lexical_cast<std::string>(numNodes); - postData["CoresPerNode"] = boost::lexical_cast<std::string>(coresPerNode); + postData["NumNodes"] = std::to_string(numNodes); + postData["CoresPerNode"] = std::to_string(coresPerNode); postData["ScriptName"] = runnable; postData[runnable] = param; diff --git a/Framework/RemoteJobManagers/src/SCARFLSFJobManager.cpp b/Framework/RemoteJobManagers/src/SCARFLSFJobManager.cpp index 35b5e2bf41e..543fd4eb590 100644 --- a/Framework/RemoteJobManagers/src/SCARFLSFJobManager.cpp +++ b/Framework/RemoteJobManagers/src/SCARFLSFJobManager.cpp @@ -89,8 +89,8 @@ void SCARFLSFJobManager::authenticate(const std::string &username, } else { throw std::runtime_error("Login failed. Please check your username and " "password. Got status code " + - boost::lexical_cast<std::string>(code) + - ", with this response: " + resp); + std::to_string(code) + ", with this response: " + + resp); } } diff --git a/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Framework/SINQ/src/PoldiFitPeaks1D2.cpp index dbb3c198410..6892cf42b7a 100644 --- a/Framework/SINQ/src/PoldiFitPeaks1D2.cpp +++ b/Framework/SINQ/src/PoldiFitPeaks1D2.cpp @@ -236,7 +236,7 @@ PoldiFitPeaks1D2::getRangeProfile(const RefinedRange_sptr &range, int n) const { } totalProfile->addFunction(FunctionFactory::Instance().createInitialized( - "name=Chebyshev,n=" + boost::lexical_cast<std::string>(n) + ",StartX=" + + "name=Chebyshev,n=" + std::to_string(n) + ",StartX=" + boost::lexical_cast<std::string>(range->getXStart()) + ",EndX=" + boost::lexical_cast<std::string>(range->getXEnd()))); diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp index 89c4e911c6d..a343fccc679 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp @@ -386,11 +386,10 @@ UncertainValue PoldiAutoCorrelationCore::getCMessAndCSigma( m_logger.warning() << "Inconsistency foun while calculating correlation " "intensity and error for d-value: " << boost::lexical_cast<std::string>(dValue) - << ", with detector index: " - << boost::lexical_cast<std::string>(index) + << ", with detector index: " << std::to_string(index) << ", got middle index: " - << boost::lexical_cast<std::string>(middleIndex) - << ", ignoring it." << std::endl; + << std::to_string(middleIndex) << ", ignoring it." + << std::endl; break; } diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp index b969ae95244..1e6472e0e04 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp @@ -102,8 +102,8 @@ void PoldiResidualCorrelationCore::distributeCorrelationCounts( m_logger.warning() << "Inconsistency foun while calculating distribute " "correlation counts for d-value with index " - << boost::lexical_cast<std::string>(k) << ", got middle index: " - << boost::lexical_cast<std::string>(middleIndex) + << std::to_string(k) + << ", got middle index: " << std::to_string(middleIndex) << ", ignoring it." << std::endl; break; } diff --git a/Framework/TestHelpers/src/ComponentCreationHelper.cpp b/Framework/TestHelpers/src/ComponentCreationHelper.cpp index fc70de74fd8..d598b90420d 100644 --- a/Framework/TestHelpers/src/ComponentCreationHelper.cpp +++ b/Framework/TestHelpers/src/ComponentCreationHelper.cpp @@ -382,13 +382,7 @@ createCylInstrumentWithDetInGivenPositions(const std::vector<double> &L2, for (size_t i = 0; i < azim.size(); i++) { Detector *physicalPixel = new Detector( - "det" + boost::lexical_cast<std::string>(i), pixelID, pixelShape, bank); - double zpos = L2[i] * cos(polar[i]); - double xpos = L2[i] * sin(polar[i]) * cos(azim[i]); - double ypos = L2[i] * sin(polar[i]) * sin(azim[i]); - physicalPixel->setPos(xpos, ypos, zpos); - pixelID++; - bank->add(physicalPixel); + "det" + std::to_string(k->add(physicalPixel); testInst->markAsDetector(physicalPixel); } testInst->add(bank); diff --git a/Framework/TestHelpers/src/MDAlgorithmsTestHelper.cpp b/Framework/TestHelpers/src/MDAlgorithmsTestHelper.cpp index e294baf0c94..eb621b4c80d 100644 --- a/Framework/TestHelpers/src/MDAlgorithmsTestHelper.cpp +++ b/Framework/TestHelpers/src/MDAlgorithmsTestHelper.cpp @@ -36,7 +36,7 @@ DataObjects::MDEventWorkspace3Lean::sptr makeFileBackedMDEW(const std::string &wsName, bool fileBacked, long numEvents, Kernel::SpecialCoordinateSystem coord) { // ---------- Make a file-backed MDEventWorkspace ----------------------- - std::string snEvents = boost::lexical_cast<std::string>(numEvents); + std::string snEvents = std::to_string(numEvents); MDEventWorkspace3Lean::sptr ws1 = MDEventsTestHelper::makeMDEW<3>(10, 0.0, 10.0, 0); ws1->getBoxController()->setSplitThreshold(100); @@ -79,7 +79,7 @@ makeFileBackedMDEWwithMDFrame(const std::string &wsName, bool fileBacked, long numEvents, Kernel::SpecialCoordinateSystem coord) { // ---------- Make a file-backed MDEventWorkspace ----------------------- - std::string snEvents = boost::lexical_cast<std::string>(numEvents); + std::string snEvents = std::to_string(numEvents); MDEventWorkspace3Lean::sptr ws1 = MDEventsTestHelper::makeAnyMDEWWithFrames<MDLeanEvent<3>, 3>( 10, 0.0, 10.0, frame, 0); diff --git a/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp b/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp index 3e4dbdf03e3..67e4ae03ed7 100644 --- a/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp +++ b/Framework/WorkflowAlgorithms/src/ConvolutionFitSequential.cpp @@ -176,9 +176,9 @@ void ConvolutionFitSequential::exec() { outputWsName += convertFuncToShort(funcName); } outputWsName += backType + "_s"; - outputWsName += boost::lexical_cast<std::string>(specMin); + outputWsName += std::to_string(specMin); outputWsName += "_to_"; - outputWsName += boost::lexical_cast<std::string>(specMax); + outputWsName += std::to_string(specMax); // Convert input workspace to get Q axis const std::string tempFitWsName = "__convfit_fit_ws"; @@ -189,7 +189,7 @@ void ConvolutionFitSequential::exec() { std::string plotPeakInput = ""; for (int i = specMin; i < specMax + 1; i++) { std::string nextWs = tempFitWsName + ",i"; - nextWs += boost::lexical_cast<std::string>(i); + nextWs += std::to_string(i); plotPeakInput += nextWs + ";"; plotPeakStringProg.report("Constructing PlotPeak name"); } @@ -345,7 +345,7 @@ void ConvolutionFitSequential::exec() { for (int i = specMin; i < specMax + 1; i++) { renamer->setProperty("InputWorkspace", groupWsNames.at(i - specMin)); std::string outName = outputWsName + "_"; - outName += boost::lexical_cast<std::string>(i); + outName += std::to_string(i); outName += "_Workspace"; renamer->setProperty("OutputWorkspace", outName); renamer->executeAsChildAlg(); -- GitLab