|
fmt
|
Formatters for standard library types not covered elsewhere. More...
#include "fmt/macros.hpp"#include <cerrno>#include <climits>#include <limits.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <version>import fmt:format;import std;Functions | |
| template<typename T, typename Deleter> | |
| auto | fmt::ptr (const std::unique_ptr< T, Deleter > &p) -> const void * |
| template<typename T> | |
| auto | fmt::ptr (const std::shared_ptr< T > &p) -> const void * |
Formatters for standard library types not covered elsewhere.
Interface partition fmt:std.
| auto fmt::ptr | ( | const std::shared_ptr< T > & | p | ) | -> const void * |
Returns the address held by a std::shared_ptr, for formatting with {}.
| p | the pointer to take the address from. |
| auto fmt::ptr | ( | const std::unique_ptr< T, Deleter > & | p | ) | -> const void * |
Returns the address held by a std::unique_ptr, for formatting with {}.
Smart pointers are not formattable directly, since the output would be ambiguous between the address and the pointee.
| p | the pointer to take the address from. |
Example:
auto p = std::make_unique<int>(42);
fmt::print("{}", fmt::ptr(p));