From 0470ec1ac9ff19d1af5ed7a5a3aeec673030c6f7 Mon Sep 17 00:00:00 2001 From: zeffy Date: Thu, 23 Jan 2020 16:57:28 -0800 Subject: [PATCH] Make suggested changes from code review --- include/fmt/chrono.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 0769284c..80b8b483 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -764,14 +764,12 @@ OutputIt format_duration_value(OutputIt out, Rep val, int precision) { template OutputIt format_duration_unit(OutputIt out) { - if (const char* unit = get_units()) { - string_view s(unit); - if (std::is_same::value) { - utf8_to_utf16 u(s); + if (string_view unit = get_units()) { + if (const_check(std::is_same())) { + utf8_to_utf16 u(unit); return std::copy(u.c_str(), u.c_str() + u.size(), out); - } else { - return std::copy(s.begin(), s.end(), out); } + return std::copy(unit.begin(), unit.end(), out); } const Char num_f[] { '[', '{', '}', ']', 's', 0 }; if (Period::den == 1) return format_to(out, num_f, Period::num);