The util::ends_with implementation is taken directly from the
implementation suggestion in the C++20 standard, but it produces a
stringop-overread warning with GCC 11.2. There's either some subtle
aspect to this that I don't understand or a compiler bug, but let's work
around it by tweaking the implementation.
Closes #1082.
ends_with(const std::string_view string, const std::string_view suffix)
{
return string.length() >= suffix.length()
- && string.compare(
- string.length() - suffix.length(), std::string_view::npos, suffix)
- == 0;
+ && string.substr(string.length() - suffix.length()) == suffix;
}
template<typename T>