Re: pseudo-specs for a String class: char &

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Mon, 01 Sep 2008 22:38:39 -0600

On Tue, 2008-09-02 at 15:37 +1200, Amos Jeffries wrote:

> There are two versions of this needed;
>
> One: const char ...() const; for read-only access to a char. With tests
> returning NULL char or other safe abortion for out-of-range requests.
>
> The other: char ...(); for write-access, with full tests for string
> expansion if necessary to store the new data.

you probably meant "char &()" for the second one, but please be extra
careful there: There are C++ gurus that consider write character access
in a string via a char reference nearly impossible to implement safely.

My recommendation is to drop character access, especially the writeable
character access via a reference from any buffer- or string-related
class.

HTH,

Alex.
Received on Tue Sep 02 2008 - 04:38:59 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 02 2008 - 12:00:02 MDT