Add ptr, a helper function for pointer formatting

This commit is contained in:
Victor Zverovich
2017-08-27 08:41:28 -07:00
parent 77c892c88e
commit 20168147dd
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -3675,6 +3675,12 @@ void vformat_to(basic_buffer<Char> &buffer, basic_string_view<Char> format_str,
}
buffer.append(pointer_from(start), pointer_from(it));
}
// Casts ``p`` to ``const void*`` for pointer formatting.
// Example:
// auto s = format("{}", ptr(p));
template <typename T>
inline const void *ptr(const T *p) { return p; }
} // namespace fmt
#if FMT_USE_USER_DEFINED_LITERALS