From: Shriramana Sharma <samjnaa@gmail.com>
To: Linux C Programming List <linux-c-programming@vger.kernel.org>
Subject: no number->string conversion in stdc++?
Date: Fri, 29 Jun 2007 05:34:06 +0530 [thread overview]
Message-ID: <46844C76.6060208@gmail.com> (raw)
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.
next reply other threads:[~2007-06-29 0:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-29 0:04 Shriramana Sharma [this message]
2007-07-01 1:02 ` no number->string conversion in stdc++? Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46844C76.6060208@gmail.com \
--to=samjnaa@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).