Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
| >>>>> "Lars" == Lars Gullik Bj�nnes <[EMAIL PROTECTED]> writes:
|
| Lars> I want to convert a string to int:
|
| Lars> int a = stream_cast<int, string>("123");
|
| Lars> or a int to string:
|
| Lars> string a = stream_cast<string, int>(123);
|
| This looks interesting indeed. The name is a bit weird, since it is
| not clear where the stream is here (from a user point of view, I
| mean).
You can also see that tostr is an specialization of stream_cast where:
template <class S>
string const stream_cast(S const & s)
{
std::ostringstream os;
os << s;
return os.str();
}
is identical to the tostr that we already use.
Lgb