File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Copyright David Abrahams 2002. Permission to copy, use,
2+ // modify, sell and distribute this software is granted provided this
3+ // copyright notice appears in all copies. This software is provided
4+ // "as is" without express or implied warranty, and with no claim as
5+ // to its suitability for any purpose.
6+
7+ #include < boost/python/module.hpp>
8+ #include < boost/python/class.hpp>
9+ #include < boost/mpl/type_list.hpp>
10+
11+ #include < complex>
12+
13+ struct M {M(const std::complex <double >&) {} };
14+
15+ BOOST_PYTHON_MODULE_INIT (bienstman5_ext)
16+ {
17+ using namespace boost ::python;
18+ using boost::mpl::type_list;
19+
20+ module m (" bienstman5_ext" );
21+
22+ m
23+ .add (class_<M>(" M" )
24+ .def_init (args<std::complex <double > const &>()))
25+ ;
26+
27+ }
28+
29+
Original file line number Diff line number Diff line change 1+ '''
2+ >>> from bienstman5_ext import *
3+ >>> m = M(1j)
4+ '''
5+ def run (args = None ):
6+ import sys
7+ import doctest
8+
9+ if args is not None :
10+ sys .argv = args
11+ return doctest .testmod (sys .modules .get (__name__ ))
12+
13+ if __name__ == '__main__' :
14+ print "running..."
15+ import sys
16+ sys .exit (run ()[0 ])
You can’t perform that action at this time.
0 commit comments