It seems that Qt changes the 'interpretation' of the returned string of std::to_string(double)
.
Example:
#include <iostream>
#include <QApplication>
#define VERSION 1.0
#define VSIZE 3
int main(int argc, char** argv) {
std::string version = std::to_string(VERSION).substr(0, VSIZE);
std::cout << version << std::endl; // everything fine
QApplication app(argc, argv);
std::cout << std::to_string(VERSION).substr(0, VSIZE); // no good
return 0;
}
The output is:
1.0
1,0
I think it's Qt because this is the thinnest example where this happens, and removing the QApplication
declaration makes it work again. How can I fix this?