From 6afb5bea8759d7bf5dbd0145f7e4f40b84c67e33 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Sun, 21 Nov 2021 17:42:05 +0100 Subject: [PATCH] Made format_args() slightly more readable --- inc/format.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/inc/format.h b/inc/format.h index 907d1d8..d65ad46 100644 --- a/inc/format.h +++ b/inc/format.h @@ -49,15 +49,18 @@ constexpr char_array_t format_args(char_array_t result, first_arg_t first_arg, o if constexpr(t_ast_i >= t_ast.size()) { return result; } else { - if (t_ast[t_ast_i].is_char()) { - result[t_result_i] = t_ast[t_ast_i].get_char(); + constexpr auto ast_node = t_ast[t_ast_i]; + + if (ast_node.is_char()) { + result[t_result_i] = ast_node.get_char(); return format_args(result, first_arg, other_args...); } else { - const auto formatted_arg = format_arg(first_arg); + constexpr auto fmt_node = ast_node.get_node(); + const auto formatted_arg = format_arg(first_arg); std::copy(formatted_arg.begin(), formatted_arg.end(), result.begin()+t_result_i); - return format_args(result, first_arg, other_args...); + return format_args(result, first_arg, other_args...); } } }