fmt
Loading...
Searching...
No Matches
std.cppm File Reference
module 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;

Classes

struct  fmt::detail::Bitint< N >
struct  fmt::detail::Ubitint< N >
struct  fmt::detail::HasFlip< T, Enable >
struct  fmt::detail::HasFlip< T, void_t< decltype(std::declval< T >().flip())> >
struct  fmt::detail::IsBitReferenceLike< T >
struct  fmt::detail::HasFormatAs< T, Enable >
struct  fmt::detail::HasFormatAs< T, void_t< decltype(formatAs(std::declval< const T & >()))> >
struct  fmt::detail::HasFormatAsMember< T, Enable >
struct  fmt::detail::HasFormatAsMember< T, void_t< decltype(Formatter< T >::formatAs(std::declval< const T & >()))> >
struct  fmt::Formatter< std::bitset< N >, Char >
struct  fmt::Formatter< std::thread::id, Char >
struct  fmt::Formatter< std::error_code >
struct  fmt::Formatter< T, char, typename std::enable_if< std::is_base_of< std::exception, T >::value >::type >
struct  fmt::Formatter< std::exception_ptr >
struct  fmt::Formatter< detail::Bitint< N >, Char >
struct  fmt::Formatter< detail::Ubitint< N >, Char >
struct  fmt::Formatter< BitRef, Char, enable_if_t< detail::IsBitReferenceLike< BitRef >::value > >
struct  fmt::Formatter< std::atomic< T >, Char, enable_if_t< IsFormattable< T, Char >::value > >
struct  fmt::IsTupleLike< std::complex< T > >
struct  fmt::Formatter< std::complex< T >, Char >
struct  fmt::Formatter< std::reference_wrapper< T >, Char, enable_if_t< IsFormattable< remove_cvref_t< T >, Char >::value &&!detail::HasFormatAs< T >::value &&!detail::HasFormatAsMember< T >::value > >

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 *

Detailed Description

Formatters for standard library types not covered elsewhere.

Interface partition fmt:std.

Function Documentation

◆ ptr() [1/2]

template<typename T>
auto fmt::ptr ( const std::shared_ptr< T > & p) -> const void *

Returns the address held by a std::shared_ptr, for formatting with {}.

Parameters
pthe pointer to take the address from.
Returns
the raw address, or null if the pointer is empty.

◆ ptr() [2/2]

template<typename T, typename Deleter>
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.

Parameters
pthe pointer to take the address from.
Returns
the raw address, or null if the pointer is empty.

Example:

auto p = std::make_unique<int>(42);
fmt::print("{}", fmt::ptr(p));