Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::formattable

      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
      formattable
      (C++23)
      Formatter
      (C++20)
      Formatting arguments
      (C++20)(deprecated in C++26)
      Format error
       
      Defined in header<format>
      template<class T,class CharT>

      concept formattable=/* formattable_with */<
       std::remove_reference_t<T>,
       std::basic_format_context</* fmt_iter_for */<CharT>, CharT>

      >;
      (1)(since C++23)
      Helper templates
      template<class CharT>
      using/* fmt_iter_for */=/* unspecified */;
      (2)(exposition only*)
      template<class T,class Context,

               class Formatter=
                   typename Context::template
                        formatter_type<std::remove_const_t<T>>>
      concept/* formattable_with */=
       std::semiregular<Formatter>&&
        requires(Formatter& f,const Formatter& cf, T&& t, Context fc,
                 std::basic_format_parse_context<
                     typename Context::char_type
                 > pc){
         { f.parse(pc)}->std::same_as<typename decltype(pc)::iterator>;
         { cf.format(t, fc)}->std::same_as<typename Context::iterator>;

       };
      (3)(exposition only*)

      The conceptformattable specifies thatstd::formatter<std::remove_cvref_t<T>, CharT> meets the requirements ofBasicFormatter andFormatter (ifstd::remove_reference_t<T> is const-qualified).

      The exposition-only alias template/* fmt_iter_for */ yields an unspecified type that satisfiesstd::output_iterator<const CharT&>.

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 3925C++23the second template argument ofstd::basic_format_context was not providedprovided

      [edit]See also

      (C++20)
      defines formatting rules for a given type
      (class template)[edit]
      abstracts formatting operations for a given formatting argument type and character type
      (named requirement)
      (C++20)
      defines functions used by theformatting library
      (named requirement)
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/format/formattable&oldid=162178"

      [8]ページ先頭

      ©2009-2025 Movatter.jp