how to avoid static member function when using gsl with c++

后端 未结 4 815
小鲜肉
小鲜肉 2020-11-28 14:21

I would like to use GSL within a c++ class without declaring member functions as static. The reason for this is because I don\'t know them too well and I\'m not

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 15:26

    GSL takes a C-type functions “int (*)(char,float)” rather than C++-type “int (Fred::*)(char,float)”. To convert a member function to the C-type function, you need to add static.

    see Is the type of “pointer-to-member-function” different from “pointer-to-function”?

提交回复
热议问题