Commit 5360ab0b authored by Victor Zverovich's avatar Victor Zverovich

Fix iteration over named arguments (#1168)

parent b615eca9
...@@ -1092,7 +1092,7 @@ template <typename Context, typename... Args> class format_arg_store { ...@@ -1092,7 +1092,7 @@ template <typename Context, typename... Args> class format_arg_store {
basic_format_arg<Context>>; basic_format_arg<Context>>;
// If the arguments are not packed, add one more element to mark the end. // If the arguments are not packed, add one more element to mark the end.
value_type data_[num_args + (!is_packed || num_args == 0 ? 1 : 0)]; value_type data_[num_args + (num_args == 0 ? 1 : 0)];
friend class basic_format_args<Context>; friend class basic_format_args<Context>;
......
...@@ -1260,9 +1260,8 @@ void arg_map<Context>::init(const basic_format_args<Context>& args) { ...@@ -1260,9 +1260,8 @@ void arg_map<Context>::init(const basic_format_args<Context>& args) {
if (arg_type == internal::named_arg_type) push_back(args.values_[i]); if (arg_type == internal::named_arg_type) push_back(args.values_[i]);
} }
} }
for (int i = 0;; ++i) { for (int i = 0, n = args.max_size(); i < n; ++i) {
auto type = args.args_[i].type_; auto type = args.args_[i].type_;
if (type == internal::none_type) return;
if (type == internal::named_arg_type) push_back(args.args_[i].value_); if (type == internal::named_arg_type) push_back(args.args_[i].value_);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment