有没有办法用Boost.Python包含C++头中的所有对象?

Cod*_*ker 5 c++ python boost

我有以下代码:

#include "boost_facade.h"

BOOST_PYTHON_MODULE (libdtlinux) {
    using namespace boost::python;
    class_<DtSearch>("DtSearch")
            .def("DoSearch", &DtSearch::DoSearch)
            .def("CreateIndex", &DtSearch::CreateIndex);
}
Run Code Online (Sandbox Code Playgroud)

我想要做的是让Boost自动添加class DtSearch和所有子方法,而不是逐个定义它们BOOST_PYTHON_MODULE.

有没有办法在头文件中包含所有对象,还是我需要像现在一样指定它们?

更新

SWIG具有我正在寻找的功能,但是我需要使用Boost.Python.这是swig的例子:

%module example
 %{
 /* Includes the header in the wrapper code */
 #include "header.h"
 %}

 /* Parse the header file to generate wrappers */
 %include "header.h"
Run Code Online (Sandbox Code Playgroud)

参考:http://www.swig.org/tutorial.htmlSWIG真正的懒惰