Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2005-12-28 03:38:55


Christopher Kohlhoff wrote:

>The problem with std::string is that it doesn't give you write
>access to an underlying buffer (as say std::vector does). This
>means that a read into a string is always going to involve a
>separate read into some other buffer first, and then a copy of
>the data into the string.
>
>
The other problem is that reading characters from sockets directly into
a std::string (which uses the platform character set and encoding) is
inherently unportable. Even if the incoming encoding is ASCII, the
platform might still use EBCDIC. Far more likely is that incoming is
UTF-8 and local ISO-8859-1 or Windows-1252 (typical Linux and Win32
platforms), which would still cause problems on German umlauts and
similar characters.
read_string would therefore have to supply a recoding function to safely
import characters.

Sebastian Redl


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