mirror of
https://github.com/fmtlib/fmt.git
synced 2026-10-29 02:17:28 +08:00
Write nullptr as a pointer in detail::write
detail::write<Char>(out, nullptr) picked the const Char* overload, so
fmt::to_string(nullptr) and FMT_COMPILE("{}") threw "string pointer is
null". Add a nullptr_t overload that forwards to the const void* one.
This commit is contained in:
parent
6151c964c6
commit
eea97b2000
@ -3913,6 +3913,11 @@ auto write(OutputIt out, const T* value, const format_specs& specs = {},
|
||||
return write_ptr<Char>(out, bit_cast<uintptr_t>(value), &specs);
|
||||
}
|
||||
|
||||
template <typename Char, typename OutputIt>
|
||||
auto write(OutputIt out, nullptr_t) -> OutputIt {
|
||||
return write<Char>(out, static_cast<const void*>(nullptr));
|
||||
}
|
||||
|
||||
template <typename Char, typename OutputIt, typename T,
|
||||
FMT_ENABLE_IF(mapped_type_constant<T, Char>::value ==
|
||||
type::custom_type &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user