Boost logo

Boost :

From: Anton Gluck (gluc_at_[hidden])
Date: 2000-11-02 02:07:35


Dave,

> OK, this non-const-reference constructor argument fix had a few unexpect
> repercussions. The quick fix is to add the following to py.h:
>
> inline const char* from_python(PyObject* x, py::Type<const char *const &>)
> {
> return from_python(x, py::Type<const char*>());
> }

Yes, that fixed the ifstream problem. Thanks again!

> > Interestingly, if I take out the ifstream lines, I'm getting very similar
> > errors with other lines (the error messages always involve some const & or
> > another).
>
> 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>());

These are the errors I get since the const/non-const fix:

d:\py_cpp/init_function.h(206) : error C2665: 'from_python' : none of the
124 overloads can convert parameter 2 from type 'struct py::Type<enum
ClassA::SomeMeasure const &>'
        d:\py_cpp/init_function.h(199) : while compiling class-template
member function 'class py::InstanceHolderBase *__thiscall py::Init2<class
py::InstanceValueHolder<class ClassB,class py::HeldInstance<class ClassB>
>,int const &,enum ClassA::SomeMeasure const &>::create_holder(class
py::ExtensionInstance *,struct _object *,struct _object *) const'
d:\py_cpp/init_function.h(207) : error C2661: 'InstanceValueHolder<class
ClassB,class py::HeldInstance<class ClassB> >::InstanceValueHolder<class
ClassB,class py::HeldInstance<class ClassB> >' : no overloaded function
takes 2 parameters
        d:\py_cpp/init_function.h(199) : while compiling class-template
member function 'class py::InstanceHolderBase *__thiscall py::Init2<class
py::InstanceValueHolder<class ClassB,class py::HeldInstance<class ClassB>
>,int const &,enum ClassA::SomeMeasure const &>::create_holder(class
py::ExtensionInstance *,struct _object *,struct _object *) const'

Time for another change to py.h?

Thanks for your help,

Toni


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