boris at codesynthesis.com
Tue Dec 13 11:42:01 EST 2005
SHAH, Sima, FM <Sima.SHAH at rbos.com> writes:
> We don't have access to the auto_pointer. The contents of the iterator
> return a reference. Is there a way to get to the pointer?
Sure, just do &. Here is the code snippet:
for (...::iterator i = ...; ...; ++i)
base* b (&*i);
if (derived1* d1 = dynamic_cast<derived1*> (b))
// b is of derived1 type, adjusted pointer in in d1
else if (derived2* d2 = dynamic_cast<derived2*> (b))
// b is of derived2 type, adjusted pointer in in d2
> P.S. Your new feature and factory mechanism idea is an excellent idea but
> we'd like to be able to do this for all classes not just subclasses.
I am not quite sure what you mean here. Can you elaborate a little bit?
The approach I described in the previous email allows one to specify
native base class for any type defined in XML Schema. Maybe you want
all types (including XML Schema built-in types such as string, token,
etc.) to derive from you base class?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051213/c4096c2e/attachment.pgp
More information about the xsd-users