Re: pseudo-specs for a String class: tokenization

From: Henrik Nordstrom <henrik_at_henriknordstrom.net>
Date: Fri, 12 Sep 2008 22:37:35 +0200

On tor, 2008-09-11 at 10:03 -0600, Alex Rousskov wrote:

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

Yes, the other approach (return a new object) is used mainly for
operators.

  C = A + B;

Methods that operate like operators is mostly confusing and needs to be
learnt one by one.. Personally I prefer functions over methods for such
use..

  C = append(a, b)

Note: append is a bad example as the + operator is a very good semantic
match.. mostly interesting when there is no good operator to use.

Regards
Henrik
Received on Fri Sep 12 2008 - 20:37:41 MDT

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