std::range-default-formatter<std::range_format::sequence>

出自cppreference.com
 
 
 
 
 
在標頭 <format> 定義
template< ranges::input_range R, class CharT >
struct /*range-default-formatter*/<range_format::sequence, R, CharT>;
(C++23 起)
(僅用於闡述*)

用於範圍類型的類模板 range-default-formatter 進行了特化,用於當 std::format_kind<R>std::range_format::sequence 時將範圍作為元素序列進行格式化。

目錄

[編輯] 成員類型

成員 定義
maybe-const-r (私有) fmt-maybe-const<R, CharT>
(僅用於闡述的成員類型*)

[編輯] 數據成員

成員 描述
std::range_formatter<std::remove_cvref_t<
    ranges::range_reference_t<maybe-const-r>>, CharT>
underlying_ (私有)
底層格式化器
(僅用於闡述的成員對象*)

[編輯] 成員函數

(構造函數)
(隱式聲明)
構造 /*range-default-formatter*/
(公開成員函數)
set_separator
設置範圍格式化結果使用指定的分隔符
(公開成員函數)
set_brackets
設置範圍格式化結果使用指定的開閉括號
(公開成員函數)
parse
按照 範圍格式說明 的說明解析格式說明符
(公開成員函數)
format
按照 範圍格式說明 寫入範圍的格式化輸出
(公開成員函數)

std::range-default-formatter<std::range_format::sequence>::set_separator

constexpr void set_separator( std::basic_string_view<CharT> sep ) noexcept;

等價於調用 underlying_.set_separator(sep)

std::range-default-formatter<std::range_format::sequence>::set_brackets

constexpr void set_brackets( std::basic_string_view<CharT> opening,
                             std::basic_string_view<CharT> closing ) noexcept;

等價於調用 underlying_.set_brackets(opening, closing)

std::range-default-formatter<std::range_format::sequence>::parse

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

等價於 return underlying_.parse(ctx);

返回範圍格式說明 的尾後迭代器。

std::range-default-formatter<std::range_format::sequence>::format

template< class FormatContext >
auto format( /*maybe-const-r*/& elems, FormatContext& ctx ) const -> FormatContext::iterator;

等價於 return underlying_.format(elems, ctx);

返回輸出範圍的尾後迭代器。

[編輯] 參閱

(C++20)
定義針對給定類型的格式化規則
(類模板) [編輯]
用於幫助實現 std::formatter 對範圍類型的特化的類模板
(類模板) [編輯]