You cannot cast from one sibling class to another. It's not an is-a relationship. You can only cast up or down the hierarchy according to what the class of the object actually is.<div><br></div><div>To go from vtkDoubleArray to vtkFloatArray, you'd have to create a new vtkFloatArray and then copy its elements over one by one, casting each element.</div>
<div><br></div><div>Casting only works up and down the parent class chain.</div><div><br></div><div>If casting is required, then there is a flaw in a design somewhere. In general, it shouldn't be required for well-designed programs.</div>
<div><br><br><div class="gmail_quote">On Fri, Sep 17, 2010 at 3:53 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">On Fri, Sep 17, 2010 at 3:50 PM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That's not a C++ cast, that's a transformation operation....<div><br></div><div>All the array classes are siblings of each other, aren't they?<br><div><br></div></div></blockquote><div><br></div></div><div>Maybe my terminology is off, but whatever it is called I feel that it should work and it currently doesn't :)</div>
<div><br></div><div>Yes, they are all siblings. Are you recommending first SafeDownCasting to a vtkDataArray, checking the type, and then performing the appropriate SafeDownCast? That seems like a lot of trouble, no?</div>
<br><font color="#888888"><div>David</div></font></div>
</blockquote></div><br></div>