Skip to content

Commit

Permalink
Fix cstyleCast error with static_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardWaiteSTFC committed Feb 11, 2025
1 parent 53c7a22 commit 22356ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ void export_IFunction1D() {
*/
class_<IFunction1D, bases<IFunction>, std::shared_ptr<IFunction1DAdapter>, 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<object (IFunction1DAdapter::*)(const object &) const>(&IFunction1DAdapter::function1D),
(arg("self"), arg("xvals")),
"Calculate the values of the function for the given x values and "
"returns them");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ void export_IPeakFunction() {
register_ptr_to_python<std::shared_ptr<IPeakFunction>>();
class_<IPeakFunction, bases<IFunction1D>, std::shared_ptr<IPeakFunctionAdapter>, 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<object (IPeakFunctionAdapter::*)(const object &) const>(&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")
Expand Down

0 comments on commit 22356ce

Please sign in to comment.