clang-format

This commit is contained in:
Walter Gray 2020-11-14 13:25:40 -08:00
parent fc3832ffa2
commit d5e3e3473e
2 changed files with 19 additions and 15 deletions

View File

@ -772,8 +772,10 @@ OutputIt format_duration_value(OutputIt out, Rep val, int) {
template <typename Char, typename Rep, typename OutputIt, template <typename Char, typename Rep, typename OutputIt,
FMT_ENABLE_IF(std::is_floating_point<Rep>::value)> FMT_ENABLE_IF(std::is_floating_point<Rep>::value)>
OutputIt format_duration_value(OutputIt out, Rep val, int precision) { OutputIt format_duration_value(OutputIt out, Rep val, int precision) {
static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{', '}', 'f', '}', 0}; static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{',
if (precision >= 0) return format_to(out, compile_string_to_view(pr_f), val, precision); '}', 'f', '}', 0};
if (precision >= 0)
return format_to(out, compile_string_to_view(pr_f), val, precision);
static FMT_CONSTEXPR_DECL const Char fp_f[] = {'{', ':', 'g', '}', 0}; static FMT_CONSTEXPR_DECL const Char fp_f[] = {'{', ':', 'g', '}', 0};
return format_to(out, compile_string_to_view(fp_f), val); return format_to(out, compile_string_to_view(fp_f), val);
} }
@ -796,9 +798,12 @@ OutputIt format_duration_unit(OutputIt out) {
if (const char* unit = get_units<Period>()) if (const char* unit = get_units<Period>())
return copy_unit(string_view(unit), out, Char()); return copy_unit(string_view(unit), out, Char());
static FMT_CONSTEXPR_DECL const Char num_f[] = {'[', '{', '}', ']', 's', 0}; static FMT_CONSTEXPR_DECL const Char num_f[] = {'[', '{', '}', ']', 's', 0};
if (const_check(Period::den == 1)) return format_to(out, compile_string_to_view(num_f), Period::num); if (const_check(Period::den == 1))
static FMT_CONSTEXPR_DECL const Char num_def_f[] = {'[', '{', '}', '/', '{', '}', ']', 's', 0}; return format_to(out, compile_string_to_view(num_f), Period::num);
return format_to(out, compile_string_to_view(num_def_f), Period::num, Period::den); static FMT_CONSTEXPR_DECL const Char num_def_f[] = {'[', '{', '}', '/', '{',
'}', ']', 's', 0};
return format_to(out, compile_string_to_view(num_def_f), Period::num,
Period::den);
} }
template <typename FormatContext, typename OutputIt, typename Rep, template <typename FormatContext, typename OutputIt, typename Rep,

View File

@ -358,9 +358,7 @@ template <typename Allocator, size_t MaxSize>
class allocator_max_size : public Allocator { class allocator_max_size : public Allocator {
public: public:
using typename Allocator::value_type; using typename Allocator::value_type;
size_t max_size() const FMT_NOEXCEPT { size_t max_size() const FMT_NOEXCEPT { return MaxSize; }
return MaxSize;
}
value_type* allocate(size_t n) { value_type* allocate(size_t n) {
if (n > max_size()) { if (n > max_size()) {
throw std::length_error("size > max_size"); throw std::length_error("size > max_size");
@ -369,8 +367,8 @@ class allocator_max_size: public Allocator {
*static_cast<Allocator*>(this), n); *static_cast<Allocator*>(this), n);
} }
void deallocate(value_type* p, size_t n) { void deallocate(value_type* p, size_t n) {
std::allocator_traits<Allocator>::deallocate( std::allocator_traits<Allocator>::deallocate(*static_cast<Allocator*>(this),
*static_cast<Allocator *>(this), p, n); p, n);
} }
}; };
@ -1808,7 +1806,8 @@ fmt::string_view to_string_view(string_like) { return "foo"; }
constexpr char with_null[3] = {'{', '}', '\0'}; constexpr char with_null[3] = {'{', '}', '\0'};
constexpr char no_null[2] = {'{', '}'}; constexpr char no_null[2] = {'{', '}'};
static FMT_CONSTEXPR_DECL const char static_with_null[3] = {'{', '}', '\0'}; static FMT_CONSTEXPR_DECL const char static_with_null[3] = {'{', '}', '\0'};
static FMT_CONSTEXPR_DECL const wchar_t static_with_null_wide[3] = {'{', '}', '\0'}; static FMT_CONSTEXPR_DECL const wchar_t static_with_null_wide[3] = {'{', '}',
'\0'};
static FMT_CONSTEXPR_DECL const char static_no_null[2] = {'{', '}'}; static FMT_CONSTEXPR_DECL const char static_no_null[2] = {'{', '}'};
static FMT_CONSTEXPR_DECL const wchar_t static_no_null_wide[2] = {'{', '}'}; static FMT_CONSTEXPR_DECL const wchar_t static_no_null_wide[2] = {'{', '}'};