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 对范围类型的特化的类模板
(类模板) [编辑]