This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[c++0x]: stoi, to_string
- From: "Germán Diago" <germandiago at gmail dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Wed, 29 Oct 2008 18:04:35 +0100
- Subject: [c++0x]: stoi, to_string
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.