Try to make starts_with compile with -std=c++11

This commit is contained in:
Roberto Rossini 2023-06-02 23:08:13 +02:00
parent f2a7e6935f
commit 8c56e7a0e0

View File

@ -679,11 +679,10 @@ template <typename Char> class basic_format_parse_context {
* Checks whether the format string starts with the given prefix * Checks whether the format string starts with the given prefix
*/ */
constexpr bool starts_with(iterator prefix) const noexcept { constexpr bool starts_with(iterator prefix) const noexcept {
auto first = begin(); std::ptrdiff_t i = 0;
auto last = end();
bool mismatch_found = false; bool mismatch_found = false;
while (first != last && *prefix != '\0') { while (begin() + i != end() && *prefix != '\0') {
if (*prefix++ != *first++) { if (*prefix++ != *(begin() + i++)) {
mismatch_found = true; mismatch_found = true;
break; break;
} }