stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Pevtsov" <Ant...@moscow.vdiweb.com>
Subject RE: Tests for lib.string::find methods
Date Wed, 03 May 2006 15:10:41 GMT
Martin Sebor wrote:
> Yes, with the naming change.

I renamed get_calls to rw_get_call_counters and committed the changes.

Martin Sebor wrote:
> I don't think it's incorrect since compare() must be implemented as if
by calling eq(), although the standard should probably not mandate > one
or the other. The way it's done in our implementation, however, is
probably going to be extremely inefficient. There are much better   >
algorithms than this naive method. We need an issue for the efficiency
side of things at the very least (I suspect the efficient algorithm  >
will end up using eq() directly).

I found that our compare implementation uses memcmp and doesn't call
eq(). 
Maybe it will be useful to open a jira issue about that?


Thanks,
Anton Pevtsov


-----Original Message-----
From: Martin Sebor [mailto:sebor@roguewave.com] 
Sent: Wednesday, May 03, 2006 05:15
To: stdcxx-dev@incubator.apache.org
Subject: Re: Tests for lib.string::find methods


Anton Pevtsov wrote:
> I committed the changes with the style change you have suggested.

Thanks!

> 
> Martin Sebor wrote:
> 
>>If the get_calls() helper is only being used in one test I'd be
> 
> inclined to leave it where it is. If and when we start using it in 
> other
> 
>>tests we should probably move it to the common header as you suggest.
> 
> 
> The get_calls will be used in test for append, assign, insert, replace

> and all find methods tests. So I suggest to move it to rw_char.h. The 
> modified tests (append, assign, insert, replace, operator +=) and this

> change are here: http://people.apache.org/~antonp/stdcxx05022006a/

Okay, in that case moving to the common header sounds like a most
reasonable plan :) We do need to rename the function according to the
naming convention, though, and perhaps even make the name more
descriptive (and less general). How does something like
rw_get_call_counters() sound?

[...]
> Are these changes ok to commit?

Yes, with the naming change.

> 
> I tried to add the same code to find methods to verify that
> Traits::length() and Traits::eq() are used.
> And I found that find method uses Traits::compare() instead of
> Traits::eq(). Is this correct?

I don't think it's incorrect since compare() must be implemented as if
by calling eq(), although the standard should probably not mandate one
or the other. The way it's done in our implementation, however, is
probably going to be extremely inefficient. There are much better
algorithms than this naive method. We need an issue for the efficiency
side of things at the very least (I suspect the efficient algorithm will
end up using eq() directly).

Martin

Mime
View raw message