名前空間
変種
操作

std::formatter<std::stack>

From cppreference.com
< cpp‎ | コンテナ‎ | stack
 
 
 
 
ヘッダ <stack> で定義
template< class CharT, class T, std::formattable<CharT> Container, class... U >
struct formatter<std::stack<T, Container, U...>, CharT>;
(C++23から)

コンテナアダプター型 std::stackstd::formatter のテンプレート特殊化により、ユーザーは基になるコンテナを、フォーマット関数を使用して要素のコレクションとしてのテキスト表現に変換できます。

特殊化は、std::formattable<Container, CharT>true の場合に有効になります。

目次

[編集] メンバー型

名前 定義
maybe-const-container fmt-maybe-const <Container, CharT>
(説明専用メンバ型*)
maybe-const-adaptor maybe-const <
    std::is_const_v<maybe-const-container>,
    std::stack<T, Container, U...>>

(説明専用メンバ型*)

[編集] データメンバー

名前 定義
underlying_ 基になるフォーマッター。型は std::formatter<ranges::ref_view<maybe-const-container>, CharT> です。
(説明用のメンバオブジェクト*)

[編集] メンバー関数

parse
range-format-spec によって指定されたフォーマット指定子を解析します。
(public member function)
format
range-format-spec によって指定された範囲フォーマット出力を書き込みます。
(public member function)

std::formatter<std::stack>::parse

template< class ParseContext >
constexpr auto parse( ParseContext& ctx ) -> ParseContext::iterator;

underlying_ .parse(ctx); に相当します。

戻り値

基になるコンテナの range-format-spec の末尾以降のイテレータ。

std::formatter<std::stack>::format

template< class FormatContext >

auto format( /*maybe-const-adaptor*/& r, FormatContext& ctx ) const

    -> FormatContext::iterator;

underlying_ .format(r.c, ctx); に相当します。

戻り値

出力範囲の末尾以降のイテレータ。

[編集]

[編集] 関連項目

(C++20)
与えられた型のフォーマット規則を定義する
(クラステンプレート) [編集]
範囲型の std::formatter 特殊化の実装を助けるクラステンプレート
(クラステンプレート) [編集]
English 日本語 中文(简体) 中文(繁體)