Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-11-02 08:23:29


----- Original Message -----
From: "Anton Gluck" <gluc_at_[hidden]>
> > More info, please?
>
> I had hoped that these would go away with the fix for ifstream, but no. So
> here's more info: You might remember that I had some enumerations with
> which you helped me earlier. They are now a problem again. Here is the
> code I added:
>
> ClassA::SomeMeasure from_python(PyObject* x,
py::Type<ClassA::SomeMeasure>)
> {
> return static_cast<ClassA::SomeMeasure>(from_python(x, py::Type<int>()));
> }
>
> and later:
>
> ClassB_class.def(py::Constructor<ClassA::SomeMeasure>());

Ah. The problem is that more things are being passed by const reference now.
That includes your ClassA::SomeMeasure [if the boost maintainer of the
call_traits library could fix it for MSVC, this wouldn't be the case, but in
the meantime I had to use my own crude mechanism]. You really needed this
addition function for completeness anyway, so you might want to add it now:

ClassA::SomeMeasure from_python(PyObject* x, py::Type<const
ClassA::SomeMeasure&>)
{
    return static_cast<ClassA::SomeMeasure>(from_python(x,
py::Type<int>()));
}

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk