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

Detailed Description

Provide a formatter customization for integer types.

Outline

Purpose

Provide a formatter customization for integer types

Classes

Canonical Header

bsl_format.h

Description

This component provides partial specializations of bsl::formatter catering for integer 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 integral types.

Usage

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

Example: Formatting an integer

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 this formatter's ability to format an integer with defined alignment and padding.

mpc.advance_to(f.parse(mpc));
int value = 42;
mfc.advance_to(bsl::as_const(f).format(value, mfc));
assert("2a***" == 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