Skip to content

Commit

Permalink
Merge pull request #8148 from diffblue/dstringt-starts_with
Browse files Browse the repository at this point in the history
dstringt::starts_with can be const
  • Loading branch information
tautschnig authored Jan 3, 2024
2 parents 6494e9e + fc7cc8f commit ba46166
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/dstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class dstringt final
}

/// equivalent of as_string().starts_with(s)
bool starts_with(const char *s)
bool starts_with(const char *s) const
{
for(const char *t = c_str(); *s != 0; s++, t++)
if(*t != *s)
Expand All @@ -103,7 +103,7 @@ class dstringt final
}

/// equivalent of as_string().starts_with(s)
bool starts_with(const std::string &prefix)
bool starts_with(const std::string &prefix) const
{
return as_string().compare(0, prefix.size(), prefix) == 0;
}
Expand Down

0 comments on commit ba46166

Please sign in to comment.