From be0e268468e588489d9bc09a4b5d876199ee4209 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 31 Aug 2018 15:34:31 -0700 Subject: [PATCH] Optimize processing of trailing '}' --- include/fmt/format.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 65101326..18175bd6 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2148,7 +2148,8 @@ FMT_CONSTEXPR void parse_format_string( // 2.5x faster than the naive one-pass implementation on long format strings. auto p = find(begin, end, '{'); if (p == end) { - write(begin, end); + if (begin != end) + write(begin, end); return; } write(begin, p);