Cache call to size() in find(): it wasn't being optimized out.
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1000 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
2d56e06cff
commit
a34780ce1e
1 changed files with 3 additions and 2 deletions
|
@ -896,9 +896,10 @@ public:
|
||||||
|
|
||||||
size_type find (const value_type* s, size_type pos, size_type n) const
|
size_type find (const value_type* s, size_type pos, size_type n) const
|
||||||
{
|
{
|
||||||
if (n + pos > size())
|
const size_type size(size());
|
||||||
|
if (n + pos > size)
|
||||||
return npos;
|
return npos;
|
||||||
for (; pos + n <= size(); ++pos)
|
for (; pos + n <= size; ++pos)
|
||||||
{
|
{
|
||||||
if (traits_type::compare(data() + pos, s, n) == 0)
|
if (traits_type::compare(data() + pos, s, n) == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue