mirror of
https://github.com/fmtlib/fmt.git
synced 2026-06-17 17:37:20 +08:00
before this change, format_as() is unable to format a type which has `auto format_as() -> const another_type&`, and `another_type` is formattable. because `format_as_result` maps the result type as it is, and the compiler refuses to compile `static_cast<T*>(nullptr)`, where T is a reference type. but it would be handy if we could use `format_as()` to format types which, for instance, owns / inherit from a formattable type, and delegate the formatter to these variables instead without creating a copy of them. in this change: * instruct `format_as_result` to map the result type to the decayed type, so that `type` can be the decayed type of result type, and this also enables `type` to be formattable, as long as the decayed type is formattable. * corresponding test is added to format-test.cc Signed-off-by: Kefu Chai <tchaikov@gmail.com> |
||
|---|---|---|
| .. | ||
| add-subdirectory-test | ||
| compile-error-test | ||
| cuda-test | ||
| find-package-test | ||
| fuzzing | ||
| gtest | ||
| static-export-test | ||
| args-test.cc | ||
| assert-test.cc | ||
| chrono-test.cc | ||
| CMakeLists.txt | ||
| color-test.cc | ||
| compile-fp-test.cc | ||
| compile-test.cc | ||
| core-test.cc | ||
| detect-stdfs.cc | ||
| enforce-checks-test.cc | ||
| format-impl-test.cc | ||
| format-test.cc | ||
| gtest-extra-test.cc | ||
| gtest-extra.cc | ||
| gtest-extra.h | ||
| header-only-test.cc | ||
| mock-allocator.h | ||
| module-test.cc | ||
| noexception-test.cc | ||
| os-test.cc | ||
| ostream-test.cc | ||
| posix-mock-test.cc | ||
| posix-mock.h | ||
| printf-test.cc | ||
| ranges-odr-test.cc | ||
| ranges-test.cc | ||
| scan-test.cc | ||
| scan.h | ||
| std-test.cc | ||
| test-assert.h | ||
| test-main.cc | ||
| unicode-test.cc | ||
| util.cc | ||
| util.h | ||
| xchar-test.cc | ||