• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 
6 #include <boost/python/module.hpp>
7 #include <boost/python/def.hpp>
8 #include <boost/python/class.hpp>
9 #include <boost/python/implicit.hpp>
10 #include <boost/mpl/list.hpp>
11 
12 struct Type1 {};
13 
TermTerm14 struct Term {Term(Type1 const&) {} };
15 
addExpression16 struct Expression {void add(Term const&) {} };
17 
BOOST_PYTHON_MODULE(bienstman4_ext)18 BOOST_PYTHON_MODULE(bienstman4_ext)
19 {
20   using namespace boost::python;
21   using boost::mpl::list;
22 
23   implicitly_convertible<Type1,Term>();
24 
25   class_<Expression>("Expression")
26       .def("add", &Expression::add)
27       ;
28 
29   class_<Type1>("T1")
30       ;
31 
32   class_<Term>("Term", init<Type1&>())
33       ;
34 
35   Type1 t1;
36   Expression e;
37   e.add(t1);
38 }
39 
40