-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunc.cpp
More file actions
34 lines (26 loc) · 703 Bytes
/
func.cpp
File metadata and controls
34 lines (26 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <boost/python.hpp>
#include <string>
int foo(int a, char b = 1, unsigned c = 2, double d = 3)
{
return a;
}
struct george
{
george(int a, char b = 'D', std::string c = "constructor", double d = 0.0)
{
}
void wack_em(int a, int b = 0, char c = 'x')
{
}
};
BOOST_PYTHON_FUNCTION_OVERLOADS(foo_overloads, foo, 1, 4)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(george_overloads, wack_em, 1, 3)
BOOST_PYTHON_MODULE(func)
{
using namespace boost::python;
def("foo", foo, foo_overloads());
class_<george>("george", no_init)
.def(init<int, optional<char, std::string, double> >())
.def("wack_em", &george::wack_em, george_overloads())
;
}