BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt_formatterpointer

Detailed Description

Provide a formatter customization for pointer types.

Outline

Purpose

Provide a formatter customization for pointer types

Classes

Canonical Header

bsl_format.h

Description

This component provides partial specializations of bsl::formatter catering for pointer types.

This header is not intended to be included directly. Please include <bsl_format.h> to be able to use specializations of the bsl::formatter for pointer types.

Usage

In this section we show the intended use of this component.

Example: Formatting a pointer

We do not expect most users of bsl::format to interact with this type directly and instead use bsl::format or bsl::vformat, so this example is necessarily unrealistic.

Suppose we want to test pointer formatter's ability to format a pointer with defined alignment and padding.

mpc.advance_to(f.parse(mpc));
const void *value = 0;
mfc.advance_to(bsl::as_const(f).format(value, mfc));
assert("0x0***" == mfc.finalString());
Definition bslfmt_mockformatcontext.h:206
Definition bslfmt_mockparsecontext.h:291
BSLS_KEYWORD_CONSTEXPR bsl::add_const< TYPE >::type & as_const(TYPE &t) BSLS_KEYWORD_NOEXCEPT
Return a reference offering non-modifiable access to the specified t.
Definition bslstl_utility.h:129
Definition bslfmt_formatterbase.h:426