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();