diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-01-07 21:01:23 +0100 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-01-08 09:10:26 +0100 |
commit | 1c121b8a9a5f4916990adcd16070a0124b0e8fbe (patch) | |
tree | 7f8a9ab16017cf7ef90872cbc2fe91b5fffce474 /examples/python/hello.cpp | |
parent | workflows/test: upgrade actions (diff) | |
download | build-boost-1c121b8a9a5f4916990adcd16070a0124b0e8fbe.tar.gz build-boost-1c121b8a9a5f4916990adcd16070a0124b0e8fbe.zip |
workflows/test: test building Boost.Pythontest
Diffstat (limited to 'examples/python/hello.cpp')
-rw-r--r-- | examples/python/hello.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/python/hello.cpp b/examples/python/hello.cpp new file mode 100644 index 0000000..b7516e4 --- /dev/null +++ b/examples/python/hello.cpp @@ -0,0 +1,19 @@ +#include <string> + +#include <boost/python.hpp> +using namespace boost::python; + +struct World +{ + void set(const std::string& msg) { this->msg = msg; } + std::string greet() const { return msg; } + std::string msg; +}; + +BOOST_PYTHON_MODULE(hello) +{ + class_<World>("World") + .def("greet", &World::greet) + .def("set", &World::set) + ; +} |