mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Fix const[expr] in context API
This commit is contained in:
@ -2627,18 +2627,20 @@ class context : private detail::locale_ref {
|
|||||||
void operator=(const context&) = delete;
|
void operator=(const context&) = delete;
|
||||||
|
|
||||||
FMT_CONSTEXPR auto arg(int id) const -> format_arg { return args_.get(id); }
|
FMT_CONSTEXPR auto arg(int id) const -> format_arg { return args_.get(id); }
|
||||||
inline auto arg(string_view name) -> format_arg { return args_.get(name); }
|
inline auto arg(string_view name) const -> format_arg {
|
||||||
FMT_CONSTEXPR auto arg_id(string_view name) -> int {
|
return args_.get(name);
|
||||||
|
}
|
||||||
|
FMT_CONSTEXPR auto arg_id(string_view name) const -> int {
|
||||||
return args_.get_id(name);
|
return args_.get_id(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an iterator to the beginning of the output range.
|
// Returns an iterator to the beginning of the output range.
|
||||||
FMT_CONSTEXPR auto out() -> iterator { return out_; }
|
FMT_CONSTEXPR auto out() const -> iterator { return out_; }
|
||||||
|
|
||||||
// Advances the begin iterator to `it`.
|
// Advances the begin iterator to `it`.
|
||||||
FMT_CONSTEXPR void advance_to(iterator) {}
|
FMT_CONSTEXPR void advance_to(iterator) {}
|
||||||
|
|
||||||
FMT_CONSTEXPR auto locale() -> detail::locale_ref { return *this; }
|
FMT_CONSTEXPR auto locale() const -> detail::locale_ref { return *this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Char = char> struct runtime_format_string {
|
template <typename Char = char> struct runtime_format_string {
|
||||||
|
@ -3708,20 +3708,21 @@ template <typename OutputIt, typename Char> class generic_context {
|
|||||||
constexpr auto arg(int id) const -> basic_format_arg<generic_context> {
|
constexpr auto arg(int id) const -> basic_format_arg<generic_context> {
|
||||||
return args_.get(id);
|
return args_.get(id);
|
||||||
}
|
}
|
||||||
auto arg(basic_string_view<Char> name) -> basic_format_arg<generic_context> {
|
auto arg(basic_string_view<Char> name) const
|
||||||
|
-> basic_format_arg<generic_context> {
|
||||||
return args_.get(name);
|
return args_.get(name);
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR auto arg_id(basic_string_view<Char> name) -> int {
|
constexpr auto arg_id(basic_string_view<Char> name) const -> int {
|
||||||
return args_.get_id(name);
|
return args_.get_id(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
FMT_CONSTEXPR auto out() -> iterator { return out_; }
|
constexpr auto out() const -> iterator { return out_; }
|
||||||
|
|
||||||
void advance_to(iterator it) {
|
void advance_to(iterator it) {
|
||||||
if (!detail::is_back_insert_iterator<iterator>()) out_ = it;
|
if (!detail::is_back_insert_iterator<iterator>()) out_ = it;
|
||||||
}
|
}
|
||||||
|
|
||||||
FMT_CONSTEXPR auto locale() -> detail::locale_ref { return loc_; }
|
constexpr auto locale() const -> detail::locale_ref { return loc_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class loc_value {
|
class loc_value {
|
||||||
|
Reference in New Issue
Block a user