[vtk-developers] The bool constructor for vtkVariant

David Gobbi david.gobbi at gmail.com
Thu May 13 13:00:02 EDT 2010


Hi All,

The bool constructor for vtkVariant has been causing me grief.  There
are two problems with it:
1) the automatic creation of a "char" from the bool is unexpected and
often confusing
2) "bool" is too permissive, I can even pass a void pointer and have
it resolve to "bool", and then vtkVariant will counterintuitively
store it as "char"

I can see why having a bool constructor would make sense, but then why
not store it as "bool" internally?

It would also be useful if vtkVariant supported vtkIdType.  Even
though vtkIdType is just a typedef, it would still be possible for
vtkVariant to recognize it as a distinct type.  In my own VTK, I have
a vtkVariant constructor method that takes a VTK type constant as a
second arg, and something like vtkVariant(10, VTK_ID_TYPE) could be
used to construct an ID-type variant.

   David



More information about the vtk-developers mailing list