This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]