linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* no number->string conversion in stdc++?
@ 2007-06-29  0:04 Shriramana Sharma
  2007-07-01  1:02 ` Glynn Clements
  0 siblings, 1 reply; 2+ messages in thread
From: Shriramana Sharma @ 2007-06-29  0:04 UTC (permalink / raw)
  To: Linux C Programming List

Hello.

I learnt today to my dismay that there is in fact no number to string 
conversion function in the standard C++ library? I can't do simple 
natural things like:

std :: string a ( 2 ) ;
std :: string b ( 2.5 ) ;

without errors at compilation talking about "no matching function for call".

I find it difficult to believe that no-one thought this was necessary 
enough to be included in the C++ standard basic_string class.

The three ways out of this problem I got to know:

1. stringstream from std, resulting in somewhat unweildy operations
2. lexical_cast from boost, resulting in dependency on huge boost lib
3. QString from Qt, resulting in depdency on huge Qt lib

Of course stdc++ is also a huge lib, but thought I can expect stdc++ to 
be there on more machines than boost or Qt.

So shall I go with std::string and std::stringstream, std::string and 
boost::lexical_cast or simply Qt's QString? QString seems most 
appealing, but I would listen to your better judgment.

Shriramana Sharma.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-01  1:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-29  0:04 no number->string conversion in stdc++? Shriramana Sharma
2007-07-01  1:02 ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).