Skip to content

Commit

Permalink
Optimize small string concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed May 19, 2020
1 parent 8d78045 commit 2aa2526
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -2513,7 +2513,12 @@ FMT_CONSTEXPR void parse_format_string(basic_string_view<Char> format_str,
Handler&& handler) {
struct writer {
FMT_CONSTEXPR void operator()(const Char* begin, const Char* end) {
if (begin == end) return;
if (begin + 1 >= end) {
if (begin == end) return;
if (*begin == '}')
return handler_.on_error("unmatched '}' in format string");
return handler_.on_text(begin, begin + 1);
}
for (;;) {
const Char* p = nullptr;
if (!find<IS_CONSTEXPR>(begin, end, '}', p))
Expand Down

0 comments on commit 2aa2526

Please sign in to comment.