i am using
Eigen::Vector2d vector(1,2)
std::cout << "x" << vector[0] << std::endl;
but this is not working because of invalid overload of cout
But this value should be double or?
Eigen::Vector2d vector(1,2)
double x = vector[0]
std::cout << "x" << x << std::endl;
this works... anyone know why ? Or what i have to do to get the double value back ?
thanks for help
Maybe the result of vector[0]
is not double
? Maybe it's some class or a custom type? In the first snippet you've explicitly converted vector[0]
to double
. If that case, try casting the result in the second snippet:
Eigen::Vector2d vector(1,2);
std::cout << "x" << (double)(vector[0]) << std::endl;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.