🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3769

Re: A couple of questions about strings

#3769
From: Beman Dawes
Date: Fri, 22 Mar 1996 02:04
26 lines
1687 bytes
 
>I'm probably beating a dead horse here, but I had a couple of
>questions about the strings class (at least, the one in the April WP).
>Specifically, there are two design decisions that I don't understand.
>
>a) Why does basic_string::copy() not also copy an ending '\0'? If
>there's some sort of good reason, why wasn't a function added that did
>this (perhaps basic_string::copy_null() or something)? I must say, it
>is very inconvenient to copy a string to a C-style array of chars with
>the current string class.

There is such a function - it is called c_str().

>b) I don't see any reason why basic_string::copy() is not a const
>function. Any particular reason for that one?

copy() is const in the current WP.


--Beman Dawes
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <1278@dawes.win.net>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back

Show Full Headers
Complete Article Headers
From: beman@dawes.win.net (Beman Dawes)
Message-ID: <1278@dawes.win.net>
X-Original-Date: Thu, 21 Mar 1996 15:42:03
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 22 Mar 96 02:04:09 GMT
Approved: fjh@cs.mu.oz.au
Organization: -
Newsgroups: comp.std.c++
X-Mailer: WinNET Mail, v2.61
Reply-To: beman@dawes.win.net (Beman Dawes)
Subject: Re: A couple of questions about strings
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMVIKouEDnX0m9pzZAQFWVQF9ERNwUD8HTptjPwhjQwPX8JqptBPT2lFl
 lorPEhbo+ORFTJZ3Z4uVi9cGuQqOdyGV
 =ncyd