[C++-sig] value_holder_back_reference::holds()
Niall Douglas
s_sourceforge at nedprod.com
Sun Nov 2 02:53:56 CET 2003
This goes as follows:
template <class Value, class Held>
void* value_holder_back_reference<Value,Held>::holds(
type_info dst_t)
{
type_info src_t = python::type_id<Value>();
Value* x = &m_held;
if (dst_t == src_t)
return x;
else if (dst_t == python::type_id<Held>())
return &m_held;
else
return find_static_type(x, src_t, dst_t);
}
Q: Why is find_static_type() used here? Shouldn't it use
find_dynamic_type() when the value is polymorphic?
I only ask because I am passing "self" in python to a class
constructor which expects a FXComposite pointer. self is python class
MainWindow which inherits off C++ class FXMainWindow which someway
down the line inherits off FXComposite, so the above should work.
Unfortunately find_static_type() is not finding the FXComposite and
is returning zero. If however I alter the "polymorphic" parameter in
convert_type() (called by find_static_type()) to true, it *does* find
the FXComposite correctly. Of course FXComposite has virtual
functions, therefore a virtual function table for RTTI to work with.
If this is not known behaviour (it seems odd that find_static_type()
is not finding base classes), I'll get to work on a repeatable
example. Just say the word.
Cheers,
Niall
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 208 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20031102/3e1b8cc8/attachment.pgp>
More information about the Cplusplus-sig
mailing list