Boost logo

Boost :

From: Peter.Bienstman_at_[hidden]
Date: 2001-07-18 02:42:30

> > TypeError: extension class 'Term' is not convertible
> > into 'Expression'.
> >
> > Short of modifying the original C++ code to add a User::User(const
> > Term&) constructor, is there anything I can do to get the Boost
> > typesystem to apply Expression::Expression(const Term&) for me?
> I am assuming that Term can be implicitly converted to (but is not
> from) Expression here. I think that in this case, you can just add
> following:
> User_.def(constructor<const Term&>);

Note that there is no User(Term) constructor in my original C++ code,
only a contructor Expression(Term) (and a conversion operator Term-
>Expression, but this does not seem to make a difference).

Anyway, adding

   User_.def(constructor<const Term&>);

, gives a compile-time error (with User replaced by Slab) :

(PyObject*, A1)
   [with A1 = boost::python::detail::reference_parameter<const
Term&>, Held =
  instantiated from `boost::python::detail::instance_holder_base*
boost::python::detail::init1<T, A1>::create_holder
(boost::python::detail::extension_instance*, PyObject*, PyObject*)
const [with T = boost::python::detail::instance_value_holder<Slab,
boost::python::detail::held_instance<Slab> >, A1 = const Term&]'
instantiated from here
: no
   matching function for call to
primitives/slab/slab.h:208: candidates are: Slab::Slab(const Slab&)
primitives/slab/slab.h:211: Slab::Slab(const

Boost list run by bdawes at, gregod at, cpdaniel at, john at