2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 05:02:17 +00:00

Merge Trunk changes to RC_1_29_0

[SVN r15732]
This commit is contained in:
Dave Abrahams
2002-10-05 12:53:06 +00:00
parent 0462c4d2f4
commit c33ac6b47a
154 changed files with 4121 additions and 9390 deletions

View File

@@ -21,25 +21,20 @@ namespace { // Avoid cluttering the global namespace.
}
}
#include <boost/python/class_builder.hpp>
namespace python = boost::python;
#include <boost/python/class.hpp>
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
BOOST_PYTHON_MODULE_INIT(getting_started2)
BOOST_PYTHON_MODULE(getting_started2)
{
// Create an object representing this extension module.
python::module_builder this_module("getting_started2");
// Create the Python type object for our extension class.
python::class_builder<hello> hello_class(this_module, "hello");
// Add the __init__ function.
hello_class.def(python::constructor<std::string>());
// Add a regular member function.
hello_class.def(&hello::greet, "greet");
// Add invite() as a regular function to the module.
this_module.def(invite, "invite");
// Even better, invite() can also be made a member of hello_class!!!
hello_class.def(invite, "invite");
using namespace boost::python;
class_<hello>("hello", init<std::string>())
// Add a regular member function.
.def("greet", &hello::greet)
// Add invite() as a member of hello!
.def("invite", invite)
;
// Also add invite() as a regular function to the module.
def("invite", invite);
}