Boost logo

Boost :

From: Joe Gottman (joegottman_at_[hidden])
Date: 2002-01-28 21:20:45


----- Original Message -----
From: "brianjparker" <brianjparker_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, January 27, 2002 10:10 PM
Subject: [boost] Re: to_string(v)

>
> A minor improvement may be to add an overload-
>
> inline
> std::string to_string(const char* in)
> {
> std::string str(in);
> return str;
> }
>
>

   How would this interact with 0? If we had to_string(const char *) and
then someone called to_string(0), would to_string(const char *) be called?
If so, this could be a problem, because I think that the string constructor
that takes a const char * will crash if it is passed a null char pointer.
Even if it didn't crash, it would return an empty string, not the string
"0".

Joe Gottman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk