On Tuesday, March 4, 2003, at 05:36 PM, Andrei Alexandrescu wrote:
"Brian Gray" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I can see how vector<Derived*> might benefit from conversion to
vector<Base*>, but we're talking about contiguous memory here.  Very
subject to raw object size, so there's no way to cast between the two
and preserve object hierarchies if they're not pointers.

The conversion vector<Derived*> to vector<Base*> is unsound. What, are we
going the way of Java containers? :o)

Heh, maybe I could have phrased it a bit better. Yes, a vector of Deriveds IS_NOT_A vector of Bases. But I can see how a developer might wish to make the conversion, however ill-advised. An int IS_NOT_A float, but people often want to convert between them. What the OP was suggesting is a whole other ball of wax. It would be like having a struct, and casting it to another arbitrary struct, mapping the memory to whatever members happened to sit there. Or bitwise replication of a float's representation into an int variable. Quite a mess.


-- Brian

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to