mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 18:12:43 +00:00
doc updates,
arbitrary arity constructors [SVN r13511]
This commit is contained in:
@@ -63,6 +63,7 @@ bpl-test data_members ;
|
||||
bpl-test bienstman1 ;
|
||||
bpl-test bienstman2 ;
|
||||
bpl-test bienstman3 ;
|
||||
bpl-test multi_arg_constructor ;
|
||||
if $(TEST_BIENSTMAN_NON_BUGS)
|
||||
{
|
||||
bpl-test bienstman4 ;
|
||||
|
||||
22
test/multi_arg_constructor.cpp
Normal file
22
test/multi_arg_constructor.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
|
||||
struct A
|
||||
{
|
||||
A(const double, const double, const double, const double, const double, const double, const double) {}
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(multi_arg_constructor_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
using boost::shared_ptr;
|
||||
|
||||
module("multi_arg_constructor_ext")
|
||||
|
||||
.add(class_<A, shared_ptr<A> >("A")
|
||||
.def_init(args<const double, const double, const double, const double, const double, const double, const double>())
|
||||
)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
16
test/multi_arg_constructor.py
Normal file
16
test/multi_arg_constructor.py
Normal file
@@ -0,0 +1,16 @@
|
||||
'''
|
||||
>>> from multi_arg_constructor_ext import *
|
||||
>>> a = A(1.0, 2, 3, 4, 5, 6, 7.0)
|
||||
'''
|
||||
def run(args = None):
|
||||
import sys
|
||||
import doctest
|
||||
|
||||
if args is not None:
|
||||
sys.argv = args
|
||||
return doctest.testmod(sys.modules.get(__name__))
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "running..."
|
||||
import sys
|
||||
sys.exit(run()[0])
|
||||
Reference in New Issue
Block a user