I am working with vtkSQLiteDatabase
, vtkTable
, and vtkVariant
. The vtkVariant
class provides various methods to convert the data it holds into different formats such as int
, float
, char
, and string
. However, when I use the toString
method, I am unable to cast the data to std::string
type.
I also tried the simplest example of vtkVariant
from the VTK examples (included below), but it doesn’t seem to work. Has anyone else encountered similar issues with vtkVariant
or have any suggestions or solutions? I am using VTK 9.4 and the ISO C++20 Standard on Windows.
VTK variant example:
#include <vtkVariant.h>
#include
#include
int main(int, char*)
{
double dVal = vtkVariant(“2”).ToDouble();
std::cout << "dVal: " << dVal << std::endl;
// I get the error in following line of code
std::string strVal = vtkVariant(dVal).ToString();
std::cout << "strVal: " << strVal << std::endl;
return EXIT_SUCCESS;
}