1// Distributed under the Boost Software License, Version 1.0. (See
2// accompanying file LICENSE_1_0.txt or copy at
3// http://www.boost.org/LICENSE_1_0.txt)
4#include <boost/python/module.hpp>
5#include <boost/python/def.hpp>
6#include <boost/python/object.hpp>
7#include <boost/python/class.hpp>
8
9using namespace boost::python;
10
11struct X
12{
13 int x;
14 X(int n) : x(n) { }
15};
16
17int x_function(X& x)
18{ return x.x;
19}
20
21
22BOOST_PYTHON_MODULE(class_ext)
23{
24 class_<X>("X", init<int>());
25 def(name: "x_function", fn: x_function);
26}
27
28#include "module_tail.cpp"
29

source code of boost/libs/python/test/class.cpp