From e00997b004713a8de4ea480d7dfb3abb11d07852 Mon Sep 17 00:00:00 2001 From: IkarusDeveloper <52773127+IkarusDeveloper@users.noreply.github.com> Date: Fri, 21 Feb 2020 23:43:07 +0100 Subject: [PATCH] improved use of find (#1560) * improved use of find *begin is supposed to be different from '{' when this find is used, so we can avoid checking it. --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index c9abfe48..f74f53e9 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2543,7 +2543,7 @@ FMT_CONSTEXPR void parse_format_string(basic_string_view format_str, // Doing two passes with memchr (one for '{' and another for '}') is up to // 2.5x faster than the naive one-pass implementation on big format strings. const Char* p = begin; - if (*begin != '{' && !find(begin, end, '{', p)) + if (*begin != '{' && !find(begin + 1, end, '{', p)) return write(begin, end); write(begin, p); ++p;