Skip to content

Commit df517aa

Browse files
committed
Remove get_dynamic_spec
1 parent 9bb14ff commit df517aa

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

include/fmt/format.h

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,32 +3696,24 @@ struct dynamic_spec_getter {
36963696
}
36973697
};
36983698

3699-
template <typename Context, typename ID>
3700-
FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> basic_format_arg<Context> {
3701-
auto arg = ctx.arg(id);
3702-
if (!arg) report_error("argument not found");
3703-
return arg;
3704-
}
3705-
37063699
template <typename Context>
3707-
FMT_CONSTEXPR auto get_dynamic_spec(
3708-
arg_id_kind kind, const arg_ref<typename Context::char_type>& ref,
3709-
Context& ctx) -> int {
3710-
FMT_ASSERT(kind != arg_id_kind::none, "");
3711-
auto arg =
3712-
kind == arg_id_kind::index ? ctx.arg(ref.index) : ctx.arg(ref.name);
3700+
FMT_CONSTEXPR void handle_dynamic_spec(
3701+
arg_id_kind kind, int& value,
3702+
const arg_ref<typename Context::char_type>& ref, Context& ctx) {
3703+
if (kind == arg_id_kind::none) return;auto arg =
3704+
kind == arg_id_kind::index ? ctx.arg(ref.index) : ctx.arg(ref.name);
37133705
if (!arg) report_error("argument not found");
3714-
unsigned long long value = arg.visit(dynamic_spec_getter());
3715-
if (value > to_unsigned(max_value<int>()))
3706+
unsigned long long result = arg.visit(dynamic_spec_getter());
3707+
if (result > to_unsigned(max_value<int>()))
37163708
report_error("width/precision is out of range");
3717-
return static_cast<int>(value);
3709+
value = static_cast<int>(result);
37183710
}
37193711

3720-
template <typename Context>
3721-
FMT_CONSTEXPR void handle_dynamic_spec(
3722-
arg_id_kind kind, int& value,
3723-
const arg_ref<typename Context::char_type>& ref, Context& ctx) {
3724-
if (kind != arg_id_kind::none) value = get_dynamic_spec(kind, ref, ctx);
3712+
template <typename Context, typename ID>
3713+
FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> basic_format_arg<Context> {
3714+
auto arg = ctx.arg(id);
3715+
if (!arg) report_error("argument not found");
3716+
return arg;
37253717
}
37263718

37273719
#if FMT_USE_NONTYPE_TEMPLATE_ARGS

0 commit comments

Comments
 (0)