std::range-...t-formatter(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– std::range-...t-formatter(3) πŸ’–

okay so bestie, welcome to this page in the C++ Standard Libary manual (yes, the header spells it β€œLibary” 😭, we’re keeping it). The title up top is std::range-...t-formatter(3), and the NAME is literally std::range-default-formatter twice. Slay, let’s go. ✨

🌸 NAME 🌸

std::range-default-formatter β€” std::range-default-formatter. That’s the whole name, no cap: both sides match, and we move on. πŸ’…

πŸ¦‹ Synopsis πŸ¦‹

Defined in header <format>:

template< ranges::input_range R, class CharT >
(since C++23)
struct range-default-formatter<range_format::sequence, R,
(exposition only*)
CharT>;

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. πŸ’–

🌈 Member types 🌈

  • maybe-const-r (private) β€” definition: /*fmt-maybe-const*/<R, CharT>; this is an (exposition-only member type*). πŸŽ€

🧚 Member objects 🧚

  • underlying_ (private) β€” the underlying formatter of type std::range_formatter<std::remove_cvref_t<ranges::range_reference_t<maybe-const-r>>, CharT>; this is an (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 🌈

  • formatter (C++20) β€” defines formatting rules for a given type; class template. πŸ’–
  • range_formatter (C++23) β€” class template that helps implementing std::formatter specializations for range types; class template. πŸ¦‹

okay bestie that’s the whole page β€” mwah πŸ’‹. Source/version and date from the footer: http://cppreference.com, 2024.06.10; page title std::range-...t-formatter(3). 🫢✨

πŸ“¦ where this page comes from