Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility/format/ranges formatter/range default formatter sequence"

From cppreference.com
m (use dsc expos mem obj)
m (~ fmt)
Line 11: Line 11:
 
{{dsc begin}}
 
{{dsc begin}}
 
{{dsc hitem|Member type|Definition}}
 
{{dsc hitem|Member type|Definition}}
{{dsc|{{tti|maybe-const-r}} {{mark|private}}|{{c/core|/*fmt-maybe-const*/<R, CharT>}}<br>{{mark expos mem type}}}}
+
{{dsc expos mem type|private=yes|maybe-const-r|{{box/core|{{lsi|cpp/utility/format#fmt-maybe-const}}{{c/core|<R, CharT>}}}}}}
 
{{dsc end}}
 
{{dsc end}}
  
Line 17: Line 17:
 
{{dsc begin}}
 
{{dsc begin}}
 
{{dsc hitem|Member name|Definition}}
 
{{dsc hitem|Member name|Definition}}
{{dsc expos mem obj|private=yes|underlying_|the underlying formatter of type {{box|{{c/core|std::range_formatter<std::remove_cvref_t<ranges::range_reference_t<}}{{tti|maybe-const-r}}{{c/core|>>, CharT>}}}}}}
+
{{dsc expos mem obj|private=yes|underlying_|the underlying formatter of type: {{box/core|{{c/core|std::range_formatter<std::remove_cvref_t<}}<br>{{nbspt|5}}{{c/core|ranges::range_reference_t<}}{{tti|maybe-const-r}}{{c/core|>>, CharT>}}}}}}
 
{{dsc end}}
 
{{dsc end}}
  

Revision as of 15:32, 13 September 2024

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
 
Defined in header <format>
template< ranges::input_range R, class CharT >
struct range-default-formatter<range_format::sequence, R, CharT>;
(since C++23)
(exposition only*)

The class template range-default-formatter for range types is specialized for formatting range as a sequence of elements if std::format_kind<R> is std::range_format::sequence.

Contents

Member types

Member type Definition
maybe-const-r (private) fmt-maybe-const<R, CharT>
(exposition-only member type*)

Member objects

Member name Definition
underlying_ (private) the underlying formatter of type: std::range_formatter<std::remove_cvref_t<
     ranges::range_reference_t<maybe-const-r>>, CharT>

(exposition-only member object*)

Member functions

(constructor)
(implicitly declared)
constructs a range-default-formatter
(public member function)
set_separator
sets a specified separator for the range formatted result
(public member function)
set_brackets
sets a specified opening and closing brackets for the range formatted result
(public member function)
parse
parses the format specifier as specified by range-format-spec
(public member function)
format
writes the range formatted output as specified by range-format-spec
(public member function)

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

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

Equivalent to a call to 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;

Equivalent to a call to underlying_.set_brackets(opening, closing).

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

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

Equivalent to return underlying_.parse(ctx);.

Returns an iterator past the end of the range-format-spec.

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

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

Equivalent to return underlying_.format(elems, ctx);.

Returns an iterator past the end of the output range.

See also

(C++20)
defines formatting rules for a given type
(class template) [edit]
class template that helps implementing std::formatter specializations for range types
(class template) [edit]