Skip to content

Commit 49dbc61

Browse files
author
Daniel Kroening
authored
Merge pull request #5189 from diffblue/string_comments
C++20 replacements for has_suffix/has_prefix
2 parents 5bbdd75 + b5dee9a commit 49dbc61

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/util/prefix.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Author: Daniel Kroening, [email protected]
1212

1313
#include <string>
1414

15+
// C++20 will have std::string::starts_with
16+
1517
inline bool has_prefix(const std::string &s, const std::string &prefix)
1618
{
1719
return s.compare(0, prefix.size(), prefix)==0;

src/util/suffix.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Author: Daniel Kroening, [email protected]
1212

1313
#include <string>
1414

15+
// C++20 will have std::string::ends_with
16+
1517
inline bool has_suffix(const std::string &s, const std::string &suffix)
1618
{
1719
if(suffix.size()>s.size())

0 commit comments

Comments
 (0)