[C++-sig] convert child class to child class {lvalue} ?
Steven Wyckoff
steven.wyckoff at gmail.com
Thu Oct 11 18:32:19 CEST 2007
Hans Meine wrote:
> Am Mittwoch, 10. Oktober 2007 23:53:06 schrieb Steven Wyckoff:
>> BOOST_PYTHON_MODULE(extending)
>> {
>> using namespace boost::python;
>>
>> class_<BaseWrap, boost::noncopyable>("baseobj")
>> .def("ID", &baseobj::ID, &BaseWrap::ID, "Returns the ID of the object")
>> .def("GetVal", &baseobj::GetVal)
>> .def("SetVal", &baseobj::SetVal)
>> ;
>>
>> class_<childobj, bases<BaseWrap> >("childobj")
>> .def("ChildOnly", &childobj::ChildOnly)
>> ;
>
> I never used wrapper<>, but did you try bases<baseobj>?
> I mean - childobj *is* derived from baseobj, not BaseWrap.
>
That was it! That was the sneaky, silly thing I was doing wrong that
broke everything. Switching to bases<baseobj> seems to let boost cast
properly when legal just as one would expect it should. Thanks for the help!
Steven
More information about the Cplusplus-sig
mailing list