This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Lexical conversion.
- From: "Claudio Bley" <bley at cs dot uni-magdeburg dot de>
- To: John Carter <john dot carter at tait dot co dot nz>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 15 Oct 2002 10:50:17 +0200
- Subject: Re: Lexical conversion.
- References: <Pine.LNX.4.44.0210151627030.8537-100000@parore>
>>>>> "John" == John Carter <john.carter@tait.co.nz> writes:
John> What is the fastest way under gcc-3.* to convert from an int
John> to a string? ie. Equivalent to this yucky bit of code...
We are talking about C++, right? I don't know how fast it is (or what
your constrains are), but I would use something like that:
#include <sstream>
string convert (const int number) {
ostringstream ostr;
ostr << number;
return ostr.str ();
}
--
Claudio Bley ASCII ribbon campaign (")
Debian GNU/Linux advocate - against HTML email X
http://www.cs.uni-magdeburg.de/~bley/ & vCards / \