diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index 7a58b4f70e9f68729e70192a0ed3207359433004..ee8fb7c957b239e4d3750a15f2af53faf8f53a31 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -540,21 +540,17 @@ void EventList::minusHelper(std::vector<T1> &events, const std::vector<T2> &more_events) { // Make the end vector big enough in one go (avoids repeated re-allocations). events.reserve(events.size() + more_events.size()); - typename std::vector<T2>::const_iterator itev; /* In the event of subtracting in place, calling the end() vector would make * it point * at the wrong place * Using it caused a segault, Ticket #2306. * So we cache the end (this speeds up too). */ - auto more_begin = more_events.cbegin(); - auto more_end = more_events.cend(); - - for (itev = more_begin; itev != more_end; itev++) { + for (const auto &ev : more_events) { // We call the constructor for T1. In the case of WeightedEventNoTime, the // pulse time will just be ignored. - events.emplace_back(itev->tof(), itev->pulseTime(), itev->weight() * (-1.0), - itev->errorSquared()); + events.emplace_back(ev.tof(), ev.pulseTime(), ev.weight() * (-1.0), + ev.errorSquared()); } } @@ -1608,7 +1604,7 @@ void EventList::compressEventsParallelHelper( events.begin() + (thread + 1) * numPerBlock; // cache for speed if (thread == numThreads - 1) it_end = events.end(); - for (; it != it_end; it++) { + for (; it != it_end; ++it) { if ((it->m_tof - lastTof) <= tolerance) { // Carry the error and weight weight += it->weight(); @@ -2479,8 +2475,7 @@ void EventList::integrateHelper(std::vector<T> &events, const double minX, } // Sum up all the weights - typename std::vector<T>::iterator it; - for (it = lowit; it != highit; it++) { + for (auto it = lowit; it != highit; ++it) { sum += it->weight(); error += it->errorSquared(); } @@ -2589,10 +2584,8 @@ template <class T> void EventList::convertTofHelper(std::vector<T> &events, std::function<double(double)> func) { // iterate through all events - typename std::vector<T>::iterator itev; - auto itev_end = events.end(); // cache for speed - for (itev = events.begin(); itev != itev_end; itev++) - itev->m_tof = func(itev->m_tof); + for (auto &ev : events) + ev.m_tof = func(ev.m_tof); } // -------------------------------------------------------------------------- diff --git a/Framework/HistogramData/CMakeLists.txt b/Framework/HistogramData/CMakeLists.txt index fdaf4a9d8f5e1079f25206c1768493673211e172..550dcd46becb2f5b20bd1eee256ff6270d582123 100644 --- a/Framework/HistogramData/CMakeLists.txt +++ b/Framework/HistogramData/CMakeLists.txt @@ -119,6 +119,7 @@ endif () # Add to the 'Framework' group in VS set_property ( TARGET HistogramData PROPERTY FOLDER "MantidFramework" ) +target_include_directories ( HistogramData PUBLIC ${Boost_INCLUDE_DIRS}) target_link_libraries ( HistogramData LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} ${GSL_LIBRARIES} ${MANTIDLIBS} ) diff --git a/Framework/Indexing/CMakeLists.txt b/Framework/Indexing/CMakeLists.txt index 33fc4cf478c8e7f3b4bc0bbc1c926f33bde33f77..775465ecb4a43563755f022e280b4b7e5bdce65b 100644 --- a/Framework/Indexing/CMakeLists.txt +++ b/Framework/Indexing/CMakeLists.txt @@ -72,6 +72,7 @@ endif () # Add to the 'Framework' group in VS set_property ( TARGET Indexing PROPERTY FOLDER "MantidFramework" ) +target_include_directories ( Indexing PUBLIC ${Boost_INCLUDE_DIRS}) target_link_libraries ( Indexing LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} ${MANTIDLIBS} Parallel ) diff --git a/Framework/Kernel/inc/MantidKernel/VMD.h b/Framework/Kernel/inc/MantidKernel/VMD.h index ec5f594c445800288f9f79a58f28841949ef1126..4cfce09de7a64fb4f59405af31167f6881bb2698 100644 --- a/Framework/Kernel/inc/MantidKernel/VMD.h +++ b/Framework/Kernel/inc/MantidKernel/VMD.h @@ -64,7 +64,6 @@ public: TYPE &operator[](const size_t index); const TYPE *getBareArray() const; std::string toString(const std::string &separator = " ") const; - template <class T> std::vector<T> toVector() const; bool operator==(const VMDBase &v) const; bool operator!=(const VMDBase &v) const; VMDBase operator+(const VMDBase &v) const; diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp index 0a789fa2b418aacd0bacd75480028a6ca8a578ac..53385cfa7e4e2200f622af62cf69d2851f8b3946 100644 --- a/Framework/Kernel/src/ConfigService.cpp +++ b/Framework/Kernel/src/ConfigService.cpp @@ -127,20 +127,6 @@ public: m_pPtr = static_cast<T *>(this); } - /// Copy constructor - WrappedObject(const WrappedObject<T> &A) : T(A) { - m_pPtr = static_cast<T *>(this); - } - - /// Overloaded = operator sets the pointer to the wrapped class - /// and copies over the contents - WrappedObject<T> &operator=(const WrappedObject<T> &rhs) { - if (this != &rhs) { - m_pPtr = static_cast<T *>(this); - *m_pPtr = rhs; - } - return *this; - } /// Overloaded * operator returns the wrapped object pointer const T &operator*() const { return *m_pPtr; } /// Overloaded * operator returns the wrapped object pointer diff --git a/Framework/Kernel/src/Matrix.cpp b/Framework/Kernel/src/Matrix.cpp index cdd07279dd59db457f98450a56ef920eb055f2c0..acb51865083949be4fe50bbbdb6ea71e3c2bf3b3 100644 --- a/Framework/Kernel/src/Matrix.cpp +++ b/Framework/Kernel/src/Matrix.cpp @@ -1454,9 +1454,8 @@ std::vector<T> Matrix<T>::toRotation() } // step 2: get scales and rescsale the matrix std::vector<T> scale(this->m_numRows); - T currentScale; for (size_t i = 0; i < this->m_numColumns; ++i) { - currentScale = T(0.); + T currentScale{0}; for (size_t j = 0; j < this->m_numRows; ++j) currentScale += (m_rawData[j][i] * m_rawData[j][i]); currentScale = static_cast<T>(sqrt(static_cast<double>(currentScale))); diff --git a/Framework/Kernel/src/VMD.cpp b/Framework/Kernel/src/VMD.cpp index a3925ff1987e8f9f9cde6306a1fbbd1e399e507a..1cafd0aa50385e128b228a4d303761161239a9ac 100644 --- a/Framework/Kernel/src/VMD.cpp +++ b/Framework/Kernel/src/VMD.cpp @@ -288,19 +288,6 @@ std::string VMDBase<TYPE>::toString(const std::string &separator) const { return mess.str(); } -/** Get the vector as a vector - * @tparam T :: type to convert to (double/float) - * @return the vector as a std::vector - */ -template <typename TYPE> -template <class T> -std::vector<T> VMDBase<TYPE>::toVector() const { - typename std::vector<T> out; - for (size_t d = 0; d < nd; d++) - out.push_back(T(data[d])); - return out; -} - /** Equals operator with tolerance factor @param v :: VMDBase for comparison @return true if the items are equal diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp index bfedf8b839098478bf579db07f3d2daa94b90c30..a3f838e593896772b38c29592e2d5db4ecef0259 100644 --- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -439,7 +439,7 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) { // e.g. from highest density down to lowest density. typename std::multimap<double, boxPtr>::reverse_iterator it2; auto it2_end = sortedBoxes.rend(); - for (it2 = sortedBoxes.rbegin(); it2 != it2_end; it2++) { + for (it2 = sortedBoxes.rbegin(); it2 != it2_end; ++it2) { signal_t density = it2->first; boxPtr box = it2->second; #ifndef MDBOX_TRACK_CENTROID diff --git a/Framework/Nexus/src/NexusFileIO.cpp b/Framework/Nexus/src/NexusFileIO.cpp index e373e252dbb4b65913fe202969850358a9c6a311..5c7f89e87b578b07f4cc6e8cc13a78fa8ad69a9d 100644 --- a/Framework/Nexus/src/NexusFileIO.cpp +++ b/Framework/Nexus/src/NexusFileIO.cpp @@ -838,12 +838,9 @@ void NexusFileIO::writeEventListData(std::vector<T> events, bool writeTOF, auto errorSquareds = new double[num]; auto pulsetimes = new int64_t[num]; - typename std::vector<T>::const_iterator it; - typename std::vector<T>::const_iterator it_end = events.end(); size_t i = 0; - // Fill the C-arrays with the fields from all the events, as requested. - for (it = events.begin(); it != it_end; it++) { + for (auto it = events.cbegin(); it != events.cend(); ++it) { if (writeTOF) tofs[i] = it->tof(); if (writePulsetime) @@ -852,7 +849,7 @@ void NexusFileIO::writeEventListData(std::vector<T> events, bool writeTOF, weights[i] = it->weight(); if (writeError) errorSquareds[i] = it->errorSquared(); - i++; + ++i; } // Write out all the required arrays. diff --git a/Framework/Parallel/CMakeLists.txt b/Framework/Parallel/CMakeLists.txt index 24668373bbe2a0674a3d95a2a4ba650297fc7cee..39e5fe6f9547f6293d1e9b6e7f610251073bad5c 100644 --- a/Framework/Parallel/CMakeLists.txt +++ b/Framework/Parallel/CMakeLists.txt @@ -63,7 +63,7 @@ endif () # Add to the 'Framework' group in VS set_property ( TARGET Parallel PROPERTY FOLDER "MantidFramework" ) -target_include_directories ( Parallel SYSTEM PRIVATE ${HDF5_INCLUDE_DIRS} ) +target_include_directories ( Parallel SYSTEM PRIVATE ${HDF5_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) target_link_libraries ( Parallel LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} ${GSL_LIBRARIES} ${MANTIDLIBS} ${HDF5_LIBRARIES} ) diff --git a/Framework/TestHelpers/src/FileComparisonHelper.cpp b/Framework/TestHelpers/src/FileComparisonHelper.cpp index ccf783e80f24838877556223c3d75f81d45e8f30..95e86c89afdfeabbb311a67536aa12be0a01e93e 100644 --- a/Framework/TestHelpers/src/FileComparisonHelper.cpp +++ b/Framework/TestHelpers/src/FileComparisonHelper.cpp @@ -12,15 +12,15 @@ using streamCharIter = std::istreambuf_iterator<char>; // Returns if the difference was due to EOL and fixes the position of the // stream if it was due to EOL -bool isEolDifference(streamCharIter streamOne, streamCharIter streamTwo) { +bool isEolDifference(streamCharIter &streamOne, streamCharIter &streamTwo) { // Check which is the Windows file stream (CR in CRLF) // and advance it by a character so we are back to LF on both if (*streamOne == '\r' && *streamTwo == '\n') { - streamOne++; + ++streamOne; } else if (*streamOne == '\n' && *streamTwo == '\r') { - streamTwo++; + ++streamTwo; } else { // Was not a different EOL so indicate false to that return false; diff --git a/MantidPlot/src/ApplicationWindow.cpp b/MantidPlot/src/ApplicationWindow.cpp index 393917067375f04d9bd489233f7620424ebdd38b..daa9a930eb8b3c3f511445e5d3be95655c114577 100644 --- a/MantidPlot/src/ApplicationWindow.cpp +++ b/MantidPlot/src/ApplicationWindow.cpp @@ -13535,14 +13535,12 @@ ApplicationWindow *ApplicationWindow::importOPJ(const QString &filename, app->recentProjects.push_front(filename); app->updateRecentProjectsList(); - // cppcheck-suppress unusedScopedObject ImportOPJ(app, filename); QApplication::restoreOverrideCursor(); return app; } else if (filename.endsWith(".ogm", Qt::CaseInsensitive) || filename.endsWith(".ogw", Qt::CaseInsensitive)) { - // cppcheck-suppress unusedScopedObject ImportOPJ(this, filename); recentProjects.removeAll(filename); recentProjects.push_front(filename); @@ -15272,7 +15270,6 @@ void ApplicationWindow::scriptsDirPathChanged(const QString &path) { } void ApplicationWindow::makeToolbarsMenu() { - // cppcheck-suppress publicAllocationError actionFileTools = new QAction(standardTools->windowTitle(), toolbarsMenu); actionFileTools->setCheckable(true); toolbarsMenu->addAction(actionFileTools); @@ -15581,7 +15578,6 @@ void ApplicationWindow::showUserDirectoryDialog() { ad->setAttribute(Qt::WA_DeleteOnClose); ad->show(); ad->setFocus(); - // cppcheck-suppress memleak } void ApplicationWindow::addCustomAction(QAction *action,