[C++-sig] Re: Automatic downcast question

Stefan Franke franke at ableton.com
Sun Jun 15 22:33:34 CEST 2003



> -----Original Message-----
> From: c++-sig-admin at python.org [mailto:c++-sig-admin at python.org]On
> Behalf Of David Abrahams
...

> I think it's reasonable to try to convert directly to the actual type
> of the pointee (C), but I don't think it's reasonable to try
> downcasting to every known derived class of the pointee's static type.

But "every known derived class" is not what I was asking for. Rather
"the lowermost class on the inheritance graph from the pointee's static
type to its actual type that has been registered to BPL via bases<>".
(Sorry if my English is weird).

This is typically exactly one class (B), unless with diamond-shaped
inheritance. In this case a non-ambivalent base class could be chosen.


> We could consider implementing that as a new return value policy,
> though, so you can ask for it when you need it.

Another option (at least for me) would be to be able to dynamically
cast a wrapped A to a wrapped C instance. Is that possible?






Stefan Franke
www.ableton.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030615/0523f6f5/attachment.htm>


More information about the Cplusplus-sig mailing list