mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 19:24:48 +02:00
Minor cleanup
This commit is contained in:
@@ -1292,7 +1292,7 @@ class compile_parse_context : public parse_context<Char> {
|
|||||||
using base::check_arg_id;
|
using base::check_arg_id;
|
||||||
|
|
||||||
FMT_CONSTEXPR void check_dynamic_spec(int arg_id) {
|
FMT_CONSTEXPR void check_dynamic_spec(int arg_id) {
|
||||||
detail::ignore_unused(arg_id);
|
ignore_unused(arg_id);
|
||||||
if (arg_id < num_args_ && types_ && !is_integral_type(types_[arg_id]))
|
if (arg_id < num_args_ && types_ && !is_integral_type(types_[arg_id]))
|
||||||
report_error("width/precision is not integer");
|
report_error("width/precision is not integer");
|
||||||
}
|
}
|
||||||
@@ -2022,7 +2022,7 @@ class container_buffer : public buffer<typename Container::value_type> {
|
|||||||
template <typename OutputIt>
|
template <typename OutputIt>
|
||||||
class iterator_buffer<
|
class iterator_buffer<
|
||||||
OutputIt,
|
OutputIt,
|
||||||
enable_if_t<detail::is_back_insert_iterator<OutputIt>::value &&
|
enable_if_t<is_back_insert_iterator<OutputIt>::value &&
|
||||||
is_contiguous<typename OutputIt::container_type>::value,
|
is_contiguous<typename OutputIt::container_type>::value,
|
||||||
typename OutputIt::container_type::value_type>>
|
typename OutputIt::container_type::value_type>>
|
||||||
: public container_buffer<typename OutputIt::container_type> {
|
: public container_buffer<typename OutputIt::container_type> {
|
||||||
|
@@ -709,7 +709,7 @@ FMT_CONSTEXPR inline auto compute_width(string_view s) -> size_t {
|
|||||||
struct count_code_points {
|
struct count_code_points {
|
||||||
size_t* count;
|
size_t* count;
|
||||||
FMT_CONSTEXPR auto operator()(uint32_t cp, string_view) const -> bool {
|
FMT_CONSTEXPR auto operator()(uint32_t cp, string_view) const -> bool {
|
||||||
*count += detail::to_unsigned(
|
*count += to_unsigned(
|
||||||
1 +
|
1 +
|
||||||
(cp >= 0x1100 &&
|
(cp >= 0x1100 &&
|
||||||
(cp <= 0x115f || // Hangul Jamo init. consonants
|
(cp <= 0x115f || // Hangul Jamo init. consonants
|
||||||
@@ -4113,6 +4113,12 @@ struct formatter<detail::float128, Char>
|
|||||||
detail::type::float_type> {};
|
detail::type::float_type> {};
|
||||||
|
|
||||||
inline namespace literals {
|
inline namespace literals {
|
||||||
|
#if FMT_USE_NONTYPE_TEMPLATE_ARGS
|
||||||
|
template <detail_exported::fixed_string Str> constexpr auto operator""_a() {
|
||||||
|
using char_t = remove_cvref_t<decltype(Str.data[0])>;
|
||||||
|
return detail::udl_arg<char_t, sizeof(Str.data) / sizeof(char_t), Str>();
|
||||||
|
}
|
||||||
|
#else
|
||||||
/**
|
/**
|
||||||
* User-defined literal equivalent of `fmt::arg`.
|
* User-defined literal equivalent of `fmt::arg`.
|
||||||
*
|
*
|
||||||
@@ -4121,16 +4127,10 @@ inline namespace literals {
|
|||||||
* using namespace fmt::literals;
|
* using namespace fmt::literals;
|
||||||
* fmt::print("The answer is {answer}.", "answer"_a=42);
|
* fmt::print("The answer is {answer}.", "answer"_a=42);
|
||||||
*/
|
*/
|
||||||
#if FMT_USE_NONTYPE_TEMPLATE_ARGS
|
|
||||||
template <detail_exported::fixed_string Str> constexpr auto operator""_a() {
|
|
||||||
using char_t = remove_cvref_t<decltype(Str.data[0])>;
|
|
||||||
return detail::udl_arg<char_t, sizeof(Str.data) / sizeof(char_t), Str>();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
constexpr auto operator""_a(const char* s, size_t) -> detail::udl_arg<char> {
|
constexpr auto operator""_a(const char* s, size_t) -> detail::udl_arg<char> {
|
||||||
return {s};
|
return {s};
|
||||||
}
|
}
|
||||||
#endif
|
#endif // FMT_USE_NONTYPE_TEMPLATE_ARGS
|
||||||
} // namespace literals
|
} // namespace literals
|
||||||
|
|
||||||
/// A fast integer formatter.
|
/// A fast integer formatter.
|
||||||
@@ -4188,7 +4188,7 @@ class format_int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the content of the output buffer as an `std::string`.
|
/// Returns the content of the output buffer as an `std::string`.
|
||||||
auto str() const -> std::string { return std::string(str_, size()); }
|
auto str() const -> std::string { return {str_, size()}; }
|
||||||
};
|
};
|
||||||
|
|
||||||
FMT_BEGIN_EXPORT
|
FMT_BEGIN_EXPORT
|
||||||
|
Reference in New Issue
Block a user