Re: pseudo-specs for a String class: tokenization

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Thu, 11 Sep 2008 10:03:47 -0600

On Thu, 2008-09-11 at 15:39 +0200, Kinkie wrote:

> There's a quite important aspect I'd like to clear: currently most
> manipulation functions modify the KBuf itself, i.e.
>
> KBuf foo.assing("foo");
> foo.append(" bar");
> // foo now contains "foo bar".
>
> An alternative would be to always return fresh KBuf, or in other words:
>
> KBuf foo.assing("foo");
> foo=foo.append(" bar");
>
> The choice was made because it's more efficient, but it may be counterintuitive.

You made the right choice. The "modifying methods modify their object"
approach is more efficient and should be expected by most C++
developers.

Alex.
Received on Thu Sep 11 2008 - 16:04:38 MDT

This archive was generated by hypermail 2.2.0 : Sat Sep 13 2008 - 12:00:05 MDT