boost-python select between overloaded methods

后端 未结 4 1985
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 21:38

Assume exist some class Foo with two overloaded methods:

class Foo
{
  ...
   void m1(A& a);
   void m1(B& b);

I need expose one of

4条回答
  •  迷失自我
    2021-01-03 22:20

    Just for completion, it is also possible to have both of them exposed at python side:

    void (Foo::*m1_a)(A&) = &Foo::m1;
    void (Foo::*m1_b)(B&) = &Foo::m1;
    
    boost::python::class_("Foo")
        .def("m1", m1_a)
        .def("m1", m1_b)
    

提交回复
热议问题