Topic: Why std::string doesn t include automatic conversi?= =?windows-1252?Q?on from the standard primitives?
Author: Peng Yu <pengyu.ut@gmail.com>
Date: Tue, 6 Jul 2010 02:30:57 CST Raw View
In order to convert an int to a string, I have to write the following.
#include <sstream>
int i = 5;
std::string s;
std::stringstream out;
out << i;
s = out.str();
I'm wondering why std::string doesn t include automatic conversion
from the standard primitives.
For example, I won't be much concise to write the following than the
above 5 lines of code. Can I suggest to add this in future C++
standard? Where the suggestion should be sent to?
std::string foo = 123
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]