Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::formatter<range>

      From cppreference.com
      <cpp‎ |utility‎ |format
       
       
       
      Formatting library
      Standard format specification
      Formatting functions
      (C++20)
      (C++20)
      (C++20)
      (C++20)
      Format strings
      Formatting concepts
      Formatter
      (C++20)
      formatter<range>
      (C++23)
      Formatting arguments
      (C++20)(deprecated in C++26)
      Format error
       
       
      Defined in header<format>
      template<ranges::input_range R,class CharT>

          requires(std::format_kind<R>!= std::range_format::disabled)&&
                   std::formattable<ranges::range_reference_t<R>, CharT>

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

      The template specialization ofstd::formatter for the range types allows users to convert a range to its textual representation as a collection of elements or a string usingformatting functions.

      The specialization is derived fromrange-default-formatter<std::format_kind<R>, R, CharT>.

      The specialization is enabled ifR satisfiesinput_range,std::format_kind<R> is notstd::range_format::disabled, andstd::formattable<ranges::range_reference_t<R>, CharT> istrue.

      This specialization meets theFormatter requirements ifconst R modelsinput_range andranges::range_reference_t<const R> modelsstd::formattable<CharT>. It always meets theBasicFormatter requirements.

      Contents

      [edit]Format specification

      The syntax ofrange-format-spec is:

      range-fill-and-align (optional)width (optional)n(optional)range-type (optional)range-underlying-spec (optional)

      The syntax is fully described inrange format specification.

      For specializations ofstd::formatter wherestd::format_kind<R> is eitherstd::range_format::string orstd::range_format::debug_string, theformat-spec isstd-format-spec instead ofrange-format-spec (which usesstd::formatter<std::basic_string<CharT>, CharT> as the underlying formatter).

      [edit]Specializations ofrange-default-formatter

      formatting utility for ranges in sequence form
      (class template specialization)[edit]
      formatting utility for ranges in map form
      (class template specialization)[edit]
      formatting utility for ranges in set form
      (class template specialization)[edit]
      formatting utility for ranges in string or escaped string form
      (class template specialization)[edit]

      [edit]Example

      This section is incomplete
      Reason: example

      [edit]See also

      (C++20)
      defines formatting rules for a given type
      (class template)[edit]
      class template that helps implementingstd::formatter specializations for range types
      (class template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/format/ranges_formatter&oldid=180823"

      [8]ページ先頭

      ©2009-2025 Movatter.jp