address easy comments
This commit is contained in:
parent
f2a5a0f27e
commit
c85d5e342c
@ -769,7 +769,6 @@ template <typename Char, typename Rep, typename OutputIt,
|
|||||||
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
|
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
|
||||||
OutputIt format_duration_value(OutputIt out, Rep val, int) {
|
OutputIt format_duration_value(OutputIt out, Rep val, int) {
|
||||||
static FMT_CONSTEXPR_DECL const Char format[] = {'{', '}', 0};
|
static FMT_CONSTEXPR_DECL const Char format[] = {'{', '}', 0};
|
||||||
|
|
||||||
return vformat_to(out, to_string_view(format),
|
return vformat_to(out, to_string_view(format),
|
||||||
make_format_args<buffer_context<Char>>(val));
|
make_format_args<buffer_context<Char>>(val));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1841,7 +1841,6 @@ inline auto format_to_n(OutputIt out, size_t n, const S& format_str,
|
|||||||
Returns the number of characters in the output of
|
Returns the number of characters in the output of
|
||||||
``format(format_str, args...)``.
|
``format(format_str, args...)``.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline size_t formatted_size(string_view format_str, Args&&... args) {
|
inline size_t formatted_size(string_view format_str, Args&&... args) {
|
||||||
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
|
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
|
||||||
|
|||||||
@ -106,7 +106,7 @@ add_fmt_test(printf-test)
|
|||||||
add_fmt_test(ranges-test)
|
add_fmt_test(ranges-test)
|
||||||
add_fmt_test(scan-test)
|
add_fmt_test(scan-test)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if (NOT MSVC)
|
||||||
# FMT_ENFORCE_COMPILE_STRING not supported under MSVC
|
# FMT_ENFORCE_COMPILE_STRING not supported under MSVC
|
||||||
# See https://developercommunity.visualstudio.com/content/problem/1277597/internal-compiler-c0001-error-on-complex-nested-la.html
|
# See https://developercommunity.visualstudio.com/content/problem/1277597/internal-compiler-c0001-error-on-complex-nested-la.html
|
||||||
add_fmt_test(enforce-compile-string-test)
|
add_fmt_test(enforce-compile-string-test)
|
||||||
|
|||||||
@ -6,13 +6,10 @@
|
|||||||
// For the license information refer to format.h.
|
// For the license information refer to format.h.
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <chrono>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "fmt/chrono.h"
|
#include "fmt/chrono.h"
|
||||||
#include "fmt/color.h"
|
#include "fmt/color.h"
|
||||||
@ -25,10 +22,7 @@
|
|||||||
void test_format_api() {
|
void test_format_api() {
|
||||||
(void)fmt::format(FMT_STRING("{}"), 42);
|
(void)fmt::format(FMT_STRING("{}"), 42);
|
||||||
(void)fmt::format(FMT_STRING(L"{}"), 42);
|
(void)fmt::format(FMT_STRING(L"{}"), 42);
|
||||||
#if !FMT_GCC_VERSION // Currently will not compile: See
|
|
||||||
// https://github.com/fmtlib/fmt/issues/2039
|
|
||||||
(void)fmt::format(FMT_STRING("noop"));
|
(void)fmt::format(FMT_STRING("noop"));
|
||||||
#endif
|
|
||||||
|
|
||||||
(void)fmt::to_string(42);
|
(void)fmt::to_string(42);
|
||||||
(void)fmt::to_wstring(42);
|
(void)fmt::to_wstring(42);
|
||||||
@ -46,11 +40,8 @@ void test_format_api() {
|
|||||||
void test_literals_api() {
|
void test_literals_api() {
|
||||||
#if FMT_USE_UDL_TEMPLATE
|
#if FMT_USE_UDL_TEMPLATE
|
||||||
using namespace fmt::literals;
|
using namespace fmt::literals;
|
||||||
|
"{}c{}"_format("ab", 1);
|
||||||
auto udl_format = "{}c{}"_format("ab", 1);
|
L"{}c{}"_format(L"ab", 1);
|
||||||
auto udl_format_w = L"{}c{}"_format(L"ab", 1);
|
|
||||||
(void)udl_format;
|
|
||||||
(void)udl_format_w;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,19 +61,8 @@ void test_text_style() {
|
|||||||
FMT_STRING("rgb(255,20,30){}{}{}"), 1, 2, 3);
|
FMT_STRING("rgb(255,20,30){}{}{}"), 1, 2, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct zstring_sentinel {};
|
void test_range() {
|
||||||
|
std::array<char, 5> hello = {'h','e','l','l','o'};
|
||||||
bool operator==(const char* p, zstring_sentinel) { return *p == '\0'; }
|
|
||||||
bool operator!=(const char* p, zstring_sentinel) { return *p != '\0'; }
|
|
||||||
|
|
||||||
struct zstring {
|
|
||||||
const char* p;
|
|
||||||
const char* begin() const { return p; }
|
|
||||||
zstring_sentinel end() const { return {}; }
|
|
||||||
};
|
|
||||||
|
|
||||||
void test_zstring() {
|
|
||||||
zstring hello{"hello"};
|
|
||||||
(void)fmt::format(FMT_STRING("{}"), hello);
|
(void)fmt::format(FMT_STRING("{}"), hello);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,5 +71,5 @@ int main() {
|
|||||||
test_literals_api();
|
test_literals_api();
|
||||||
test_chrono();
|
test_chrono();
|
||||||
test_text_style();
|
test_text_style();
|
||||||
test_zstring();
|
test_range();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user