From 22356ceb525557bee9ef7085795e65b8a602cc83 Mon Sep 17 00:00:00 2001 From: Richard Waite Date: Tue, 11 Feb 2025 12:20:48 +0000 Subject: [PATCH] Fix cstyleCast error with static_cast --- .../PythonInterface/mantid/api/src/Exports/IFunction1D.cpp | 5 ++--- .../PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IFunction1D.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IFunction1D.cpp index 75fb3fc0926c..7a9072799703 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IFunction1D.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IFunction1D.cpp @@ -20,9 +20,8 @@ void export_IFunction1D() { */ class_, std::shared_ptr, boost::noncopyable>( "IFunction1D", "Base class for 1D Fit functions") - // suppress c-style cast of Function1D object - think this is desired behaviour - // cppcheck-suppress cstyleCast - .def("function1D", (object(IFunction1DAdapter::*)(const object &) const)&IFunction1DAdapter::function1D, + .def("function1D", + static_cast(&IFunction1DAdapter::function1D), (arg("self"), arg("xvals")), "Calculate the values of the function for the given x values and " "returns them"); diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp index 164f0bdff9c4..5ff042f9748b 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp @@ -19,9 +19,8 @@ void export_IPeakFunction() { register_ptr_to_python>(); class_, std::shared_ptr, boost::noncopyable>( "IPeakFunction", "Base class for peak Fit functions") - // suppress c-style cast of IPeakFunction object - think this is desired behaviour - // cppcheck-suppress cstyleCast - .def("functionLocal", (object(IPeakFunctionAdapter::*)(const object &) const)&IPeakFunctionAdapter::functionLocal, + .def("functionLocal", + static_cast(&IPeakFunctionAdapter::functionLocal), (arg("self"), arg("vec_x")), "Calculate the values of the function for the given x values. The " "output should be stored in the out array")