2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-24 18:12:43 +00:00

added cursor feature (including tests) and updated documentation

[SVN r8367]
This commit is contained in:
Ullrich Köthe
2000-11-30 16:11:59 +00:00
parent 33d898bf30
commit 7e672720f1
4 changed files with 199 additions and 5 deletions

View File

@@ -10,6 +10,7 @@
#include <stdio.h> // used for portability on broken compilers
#include <math.h> // for pow()
#include <boost/rational.hpp>
#include <list>
namespace bpl_test {
@@ -1009,6 +1010,15 @@ void init_module(boost::python::module_builder& m)
// export non-operator function as heterogeneous reverse-argument operator
int_class.def(&rmul, "__rmul__");
// wrap an STL conforming container
boost::python::class_builder<std::list<Int> > intlist_class(m, "IntList");
intlist_class.def(boost::python::constructor<>());
intlist_class.def((void (std::list<Int>::*)(Int const &))
&std::list<Int>::push_back, "append");
// wrap the iterator of an STL conforming container in a cursor
m.def_cursor_for(intlist_class);
boost::python::class_builder<EnumOwner> enum_owner(m, "EnumOwner");
enum_owner.def(boost::python::constructor<EnumOwner::enum_type, const EnumOwner::enum_type&>());