mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-04 17:26:42 +00:00
Add pointer support to basic_writer
This commit is contained in:
parent
91721caa42
commit
ce4a65ffea
@ -2553,6 +2553,14 @@ class basic_writer {
|
||||
void write(basic_string_view<char_type> str, FormatSpecs... specs) {
|
||||
write_str(str, format_specs(specs...));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_same<T, void>::value>::type write(const T* p) {
|
||||
format_specs specs;
|
||||
specs.flags_ = HASH_FLAG;
|
||||
specs.type_ = 'x';
|
||||
write_int(reinterpret_cast<uintptr_t>(p), specs);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Range>
|
||||
|
@ -1609,6 +1609,7 @@ TEST(FormatTest, UdlTemplate) {
|
||||
|
||||
TEST(FormatTest, ToString) {
|
||||
EXPECT_EQ("42", fmt::to_string(42));
|
||||
EXPECT_EQ("0x1234", fmt::to_string(reinterpret_cast<void*>(0x1234)));
|
||||
}
|
||||
|
||||
TEST(FormatTest, ToWString) {
|
||||
|
Loading…
Reference in New Issue
Block a user