pybind11_demo/main.cpp

17 lines
450 B
C++
Raw Normal View History

2024-06-16 10:06:49 +00:00
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
int add(int i, int j) {
return i + j;
}
std::vector<int> sort_num(std::vector<int> array){
std::sort(array.begin(),array.end());
return array;
}
PYBIND11_MODULE(test_pybind11, m) {
m.doc() = "pybind11 example plugin"; // optional module docstring
m.def("sort_num",&sort_num,"A function to sort INT numbers");
m.def("add", &add, "A function that adds two numbers");
}