|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2000-11-06 09:18:35
----- Original Message -----
From: "Anton Gluck" <gluc_at_[hidden]>
> Dave,
>
> This just might be the last problem I'll have to bother you with. Since
> the problems with references as parameters to constructors have been
> solved, I was surprised to run into one such problem again, this time with
> a reference as a function parameter. This is the definition of the
> function I need to wrap:
>
> Model::Assign(RecordIterator& cases)
>
> I am wrapping it like this:
>
> Model_class.def(Model::Assign, "Assign");
>
> And this is the error message:
>
> d:\py_cpp/caller.h(43) : error C2665: 'from_python' : none of the 158
> overloads can convert parameter 2 from type 'struct py::Type<class
> AIterator<class Record> &>'
> d:\py_cpp/functions.h(54) : see reference to function template
> instantiation 'struct _object *__cdecl py::Caller<class
> MCClass::MCStatus>::call(class MCClass::MCStatus (__thiscall
> Model::*)(class AIterator<class Record> &),struct _object *,struct _object
> *)' being compiled
Have you exposed RecordIterator with a ClassWrapper? Is the ClassWrapper
visible in the code /before/ your attempt to def this function? If not, make
it so. If so, it may be an MSVC bug. Someone else uncovered a strange bug
where some from_python() functions were not being instantiated. Oddly, it
could be turned off by adding an extra parameter to one of his constructors
(I'm not suggesting that - actually, I'd suggest you get a real compiler).
> I suppose this means that a custom from_python needs to be written, but to
> what does the reference need to be converted?
I hope not, but if you are convinced you have the aforementioned bug, try
copying the from_python(PyObject*, py::Type<T&>) function from
py::PyExtensionClassConverters.
> As usual, I'll appreciate your help.
>
> Now that I think of it, there is also this issue that I cast aside for
> now: How do I access variables of wrapped classes? There is this settings
> class, which has several default values defined. For example, Settings.h
> defines:
>
> enum Criterion {
> kBIC = 1,
> kAIC
> };
These are not variables. See the section in the new docs on enumeration
constants. I know I've covered this before...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk