bug fix
This commit is contained in:
@@ -673,16 +673,24 @@ namespace TinySTL{
|
|||||||
}
|
}
|
||||||
size_t string::find_last_of(const string& str, size_t pos) const{
|
size_t string::find_last_of(const string& str, size_t pos) const{
|
||||||
pos = changeVarWhenEuqalNPOS(pos, size(), 1);
|
pos = changeVarWhenEuqalNPOS(pos, size(), 1);
|
||||||
return find_last_of(str.begin(), pos, pos + 1);
|
//return find_last_of(str.begin(), pos, pos + 1);
|
||||||
|
return find_last_of(str.begin(), pos, str.size());
|
||||||
}
|
}
|
||||||
size_t string::find_last_of(const char* s, size_t pos) const{
|
size_t string::find_last_of(const char* s, size_t pos) const{
|
||||||
pos = changeVarWhenEuqalNPOS(pos, size(), 1);
|
pos = changeVarWhenEuqalNPOS(pos, size(), 1);
|
||||||
return find_last_of(s, pos, pos + 1);
|
//return find_last_of(s, pos, pos + 1);
|
||||||
|
return find_last_of(s, pos, strlen(s));
|
||||||
}
|
}
|
||||||
size_t string::find_last_of(const char* s, size_t pos, size_t n) const{
|
size_t string::find_last_of(const char* s, size_t pos, size_t n) const{
|
||||||
for (size_t i = pos, j = 0; i >= 0 && j != n; --i, ++j){
|
/*for (size_t i = pos, j = 0; i >= 0 && j != n; --i, ++j){
|
||||||
if (isContained((*this)[i], s, s + strlen(s)))
|
if (isContained((*this)[i], s, s + strlen(s)))
|
||||||
return i;
|
return i;
|
||||||
|
}*/
|
||||||
|
//bug fix
|
||||||
|
//2014.12.25
|
||||||
|
for (size_t i = pos; i > 0; --i){
|
||||||
|
if (isContained((*this)[i], s, s + n))
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user