[c++0x]: stoi, to_string
Germán Diago
germandiago@gmail.com
Wed Oct 29 17:04:00 GMT 2008
Hello, I would like to know if this is correct. I'm using a recent svn
version of gcc (maybe 2 weeks ago or so):
#include <string>
#include <iostream>
int main() {
using namespace std;
cout << stoi("0xff") << endl;
cout << to_string(static_cast<long long>(10)) << endl;
}
In this program, stoi returns 0. Is this correct? I think it should
throw an exception std::invalid_argument or interpret this as hex.
It's my guess, anyway I haven't
read what the standard says about it. And to_string causes ambiguity.
Is this because of c++ overloading? Do I really need to cast? Thanks.
More information about the Libstdc++
mailing list