Re: StringNG merge?

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Sun, 13 Jan 2013 22:20:25 -0700

On 12/16/2012 03:02 PM, Kinkie wrote:

> SBuf::find_first_of(const SBuf &set, size_type startPos) const
> {
...
> if (set.length() == 0)
> return 0;

If the set of characters is empty, a position of a character from that
set cannot be zero. It has to be npos.

Please add an empty set test case or fix the existing one.

> char needleBegin = needle[0];

Please make needleBegin constant everywhere.

> SBuf::find(const SBuf &needle, size_type startPos) const
> {
> char *begin = buf()+startPos;
> char *lastPossible = buf()+length()-needle.length()+1;

It is unfortunate that we are able to break const-correctness without
any compiler warnings. Please make these and similar variables in const
methods such as find() and rfind() point to "const char *".

Please make lastPossible const.

Thank you,

Alex.
Received on Mon Jan 14 2013 - 05:20:31 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 14 2013 - 12:00:06 MST