bug fix
This commit is contained in:
@@ -652,15 +652,21 @@ namespace TinySTL{
|
||||
return find(c, pos);
|
||||
}
|
||||
size_t string::find_first_not_of(const string& str, size_t pos) const{
|
||||
return find_first_not_of(str.begin(), pos, size() - pos);
|
||||
//return find_first_not_of(str.begin(), pos, size() - pos);
|
||||
return find_first_not_of(str.begin(), pos, str.size());
|
||||
}
|
||||
size_t string::find_first_not_of(const char* s, size_t pos) const{
|
||||
return find_first_not_of(s, pos, size() - pos);
|
||||
//return find_first_not_of(s, pos, size() - pos);
|
||||
return find_first_not_of(s, pos, strlen(s));
|
||||
}
|
||||
size_t string::find_first_not_of(const char* s, size_t pos, size_t n) const{
|
||||
for (size_t i = pos; i != pos + n; ++i){
|
||||
/*for (size_t i = pos; i != pos + n; ++i){
|
||||
if (!isContained((*this)[i], s, s + strlen(s)))
|
||||
return i;
|
||||
}*/
|
||||
for (size_t i = pos; i != size(); ++i){
|
||||
if (!isContained((*this)[i], s, s + n))
|
||||
return i;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
@@ -699,16 +705,24 @@ namespace TinySTL{
|
||||
}
|
||||
size_t string::find_last_not_of(const string& str, size_t pos) const{
|
||||
pos = changeVarWhenEuqalNPOS(pos, size(), 1);
|
||||
return find_last_not_of(str.begin(), pos, size());
|
||||
//return find_last_not_of(str.begin(), pos, size());
|
||||
return find_last_not_of(str.begin(), pos, str.size());
|
||||
}
|
||||
size_t string::find_last_not_of(const char* s, size_t pos) const{
|
||||
pos = changeVarWhenEuqalNPOS(pos, size(), 1);
|
||||
return find_last_not_of(s, pos, pos + 1);
|
||||
//return find_last_not_of(s, pos, pos + 1);
|
||||
return find_last_not_of(s, pos, strlen(s));
|
||||
}
|
||||
size_t string::find_last_not_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)))
|
||||
return i;
|
||||
}*/
|
||||
//bug fix
|
||||
//2014.12.24
|
||||
for (size_t i = pos; i >= 0; --i){
|
||||
if (!isContained((*this)[i], s, s + n))
|
||||
return i;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user