Boost.Python
S. Fletcher, C. Gardner · 2012
Appendix BBoost.Python The Boost.Python library provides a framework for seamlessly wrapping C++ classes, functions and objects to Python, and vice-versa.No special tools are used -just the C++ compiler.The library has been so designed that you should not have to change the C++ code in order to wrap it.Through the use of advanced metaprogramming techniques in Boost.Python, the syntax of the actual wrapping code, has the look of a declarative interface definition language.In this appendix we introduce the core features of Boost.Python.The sections are loosely based on the online Getting Started Tutorial in the Boost.Python distribution.For more exhaustive documentation, the reader is encouraged to consult the online reference manual at http://www.boost.org.>>> import hello ext >>> print hello ext.greet() B.2 CLASSES, CONSTRUCTORS AND METHODSLet's consider a C++ class/struct that we want to expose to Python: struct World { World(std::string msg): msg(msg) {} void set(std::string other) { msg = other; }