Test use of std::string::ends_with

This commit is contained in:
Charles Dang 2024-07-18 11:46:45 -04:00
parent 8a67ee5101
commit e0507c1156

View file

@ -293,7 +293,11 @@ bool file_tree_checksum::operator==(const file_tree_checksum &rhs) const
bool ends_with(const std::string& str, const std::string& suffix)
{
#ifdef __cpp_lib_starts_ends_with
return str.ends_with(suffix);
#else
return str.size() >= suffix.size() && std::equal(suffix.begin(),suffix.end(),str.end()-suffix.size());
#endif
}
std::string read_map(const std::string& name)