From a0dcfbc57bdf0a111b76929379668420420d2715 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 21 Aug 2020 06:54:05 -0700 Subject: [PATCH] Add ptr to docs --- doc/api.rst | 4 ++++ include/fmt/format.h | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/api.rst b/doc/api.rst index 8c1db764..6d357dc0 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -304,6 +304,10 @@ Utilities .. doxygentypedef:: fmt::char_t +.. doxygenfunction:: fmt::ptr(const T *) +.. doxygenfunction:: fmt::ptr(const std::unique_ptr&) +.. doxygenfunction:: fmt::ptr(const std::shared_ptr&) + .. doxygenfunction:: fmt::to_string(const T&) .. doxygenfunction:: fmt::to_wstring(const T&) diff --git a/include/fmt/format.h b/include/fmt/format.h index 5b7f6b52..63e21838 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3347,9 +3347,15 @@ typename Context::iterator vformat_to( return h.context.out(); } -// Casts ``p`` to ``const void*`` for pointer formatting. -// Example: -// auto s = format("{}", ptr(p)); +/** + \rst + Converts ``p`` to ``const void*`` for pointer formatting. + + **Example**:: + + auto s = fmt::format("{}", fmt::ptr(p)); + \endrst + */ template inline const void* ptr(const T* p) { return p; } template inline const void* ptr(const std::unique_ptr& p) { return p.get();