{"id":338078,"date":"2022-09-07T15:02:01","date_gmt":"2022-09-07T15:02:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338078"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338078","title":{"rendered":"<span>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0438 std::format \u0432 C++20<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/358\/1ee\/44c\/3581ee44ceaa48a1941b5d9fa5556949.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/358\/1ee\/44c\/3581ee44ceaa48a1941b5d9fa5556949.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a10\/f8a\/35f\/a10f8a35f491120ded40be8c606584c0.png\" width=\"800\" height=\"256\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a10\/f8a\/35f\/a10f8a35f491120ded40be8c606584c0.png\"\/><figcaption><\/figcaption><\/figure>\n<p><code>std::format<\/code> \u2014 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 (\u0438 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435) \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 C++20, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u043d\u0430\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041e\u043d\u043e \u043f\u0440\u0438\u0432\u043d\u043e\u0441\u0438\u0442 \u0432 \u044f\u0437\u044b\u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0441\u0442\u0438\u043b\u0435 Python \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u044b) \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u043e\u0432\u043e\u0439 <code>std::format<\/code> \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439.<\/p>\n<h3>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 std::format \u00a0\u00a0\u00a0<\/h3>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u044d\u0442\u043e\u0442 Hello World:<\/p>\n<pre><code>#include &lt;format> #include &lt;iostream> #include &lt;chrono>  int main() {     auto ym = std::chrono::year { 2022 } \/ std::chrono::July;     std::string msg = std::format(\"{:*^10}\\n{:*>10}\\nin{}!\", \"hello\", \"world\", ym);     std::cout &lt;&lt; msg; }<\/code><\/pre>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 <a href=\"https:\/\/godbolt.org\/z\/3zaWjWsf9\">Compiler Explorer<\/a>.<\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>**hello*** *****world in2022\/Jul!<\/code><\/pre>\n<p>\u041c\u044b \u0437\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 <code>std::string<\/code>. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/format\/formatter#Standard_format_specification\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b<\/a> \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u043e\u043c (\u0442\u0438\u043f, \u0434\u043b\u0438\u043d\u0430, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0438 \u0442. \u0434.). \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0435\u0441\u0442\u043e\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c <code>{}<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (\u043a \u0441\u043b\u043e\u0432\u0443, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 <code>std::chrono<\/code>!). \u041f\u043e\u0437\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442-\u043f\u043e\u0442\u043e\u043a.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0438 \u0444\u0438\u0447\u0430\u0445 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c <a href=\"https:\/\/www.cppstories.com\/2020\/02\/extra-format-cpp20.html\/#user-defined-types\">\u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.\u00a0<\/p>\n<h3>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u044b \u00a0\u00a0\u00a0<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <code>std::format<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u044b:<\/p>\n<ul>\n<li>\n<p><code>char<\/code>, <code>wchar_t<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f <code>std::basic_string<\/code>, <code>std::basic_string_view<\/code>, \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0438\u043f\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438: <code>void*<\/code>, <code>const void*<\/code> \u0438 <code>nullptr_t<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 <code>formatter<\/code>, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u043e \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"https:\/\/timsong-cpp.github.io\/cppwp\/n4861\/format.formatter.spec\">[format.formatter.spec]<\/a>:<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u043c:<\/p>\n<pre><code>std::cout &lt;&lt; std::format(\"10 = {}, 42 = {:10}\\n\", 10, 42);<\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u0432\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430, \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u041d\u0430 \u043d\u0438\u0445 \u043b\u0435\u0436\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0438 \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u044b\u0432\u043e\u0434.<\/p>\n<p>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u043e\u0432:<\/p>\n<pre><code>template&lt;> struct formatter&lt;char, char>; template&lt;> struct formatter&lt;char, wchar_t>; template&lt;> struct formatter&lt;wchar_t, wchar_t>;<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 <code>charT<\/code>:<\/p>\n<pre><code>template&lt;> struct formatter&lt;charT*, charT>; template&lt;> struct formatter&lt;const charT*, charT>; template&lt;size_t N> struct formatter&lt;const charT[N], charT>; template&lt;class traits, class Allocator>   struct formatter&lt;basic_string&lt;charT, traits, Allocator>, charT>; template&lt;class traits>   struct formatter&lt;basic_string_view&lt;charT, traits>, charT>;<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e <code>charT<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e cv-\u043d\u0435\u043a\u0432\u0430\u043b\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 ArithmeticT, \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f <code>char<\/code>, <code>wchar_t<\/code>, <code>char8_t<\/code>, <code>char16_t<\/code> \u0438\u043b\u0438 <code>char32_t<\/code>, \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<pre><code>template&lt;> struct formatter&lt;ArithmeticT, charT>;<\/code><\/pre>\n<p>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 <code>charT<\/code>:<\/p>\n<pre><code>template&lt;> struct formatter&lt;nullptr_t, charT>; template&lt;> struct formatter&lt;void*, charT>; template&lt;> struct formatter&lt;const void*, charT>;<\/code><\/pre>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c:<\/p>\n<pre><code>int val = 10; std::cout &lt;&lt; std::format(\"val = {}, &amp;val = {}\\n\", val, &amp;val);<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0438 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 (\u043d\u0435 \u0441\u0430\u043c\u0443\u044e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0443\u044e, \u043d\u043e \u0437\u0430\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e):<\/p>\n<pre><code>auto std::make_format_args&lt;std::format_context,int,int*>(const int &amp;,int *const &amp;)'\u00a0  was being compiled and failed to find the required specializations (\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043d\u0435 \u0441\u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u044b\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439)...<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 <code>int*<\/code>, \u043d\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e <code>void*<\/code>. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e \u043e\u0431\u043e\u0439\u0442\u0438, \u043d\u0430\u043f\u0438\u0441\u0430\u0432:<\/p>\n<pre><code>int val = 10; std::cout &lt;&lt; std::format(\"val = {}, &amp;val = {}\\n\", val, static_cast&lt;void*>(&amp;val));\u00a0<\/code><\/pre>\n<p>\u0418 \u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 (MSVC, x64, Debug):<\/p>\n<pre><code>val = 10, &amp;val = 0xf5e64ff2c4<\/code><\/pre>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <code>{fmt}<\/code> \u0434\u0430\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043d\u043e \u0432 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435, \u0443\u0432\u044b, \u043d\u0435\u0442.<\/p>\n<pre><code>template&lt;typename T> auto fmt::ptr(T p) -> const void*<\/code><\/pre>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0430 \u0447\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432?<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <code>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 &lt;&lt;,<\/code> \u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041d\u043e \u0442\u0430\u043a \u0436\u0435 \u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f <code>std::format<\/code>?<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f.<\/p>\n<h3>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u044b \u00a0\u00a0\u00a0<\/h3>\n<p>\u0421 <code>std::format<\/code> \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e formatter\u2018\u0430 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;MyType> {     constexpr auto parse(std::format_parse_context&amp; ctx) {         return \/* *\/;     }      auto format(const MyType&amp; obj, std::format_context&amp; ctx) {         return std::format_to(ctx.out(), \/* *\/);     } };<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (\u0438\u0437 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430):<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"106\" width=\"106\">\n<p align=\"left\"><strong>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\"><strong>\u0422\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"106\" width=\"106\">\n<p align=\"left\">f.parse(pc)<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">PC::iterator<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0430\u0440\u0441\u0438\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 ([format.string]) \u0434\u043b\u044f \u0442\u0438\u043f\u0430 T \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 [pc.begin( ), pc.end()] \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043d\u0435\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430. \u0412\u044b\u0434\u0430\u0435\u0442 <code>format_error<\/code>, \u0435\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0435\u043d \u0432\u0435\u0441\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0435 \u201c}\u201d. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430\u043c \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0432 <code>*this<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430 \u043a\u043e\u043d\u0446\u043e\u043c \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"106\" width=\"106\">\n<p align=\"left\">f.format(t, fc)<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">FC::iterator<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u0435\u0442 t \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u0432 <code>*this<\/code>, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0432 <code>fc.out()<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430 \u043a\u043e\u043d\u0446\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430. \u0412\u044b\u0432\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 t, <code>fc.locale()<\/code> \u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 [<code>pc.begin()<\/code>, <code>pc.end()<\/code>] \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>f.parse(pc)<\/code>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0422\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u0447\u0435\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043b\u044f <code>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &lt;&lt;<\/code>, \u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u0432\u0443\u0447\u0438\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0442 \u043d\u0430\u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442.<\/p>\n<h4>\u041e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00a0\u00a0\u00a0\u00a0<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0438\u043f-\u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0441 \u043e\u0434\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code>struct Index {     unsigned int id_{ 0 }; };<\/code><\/pre>\n<p>\u0418 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Index> {     \/\/ \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0433\u0430     formatter() { std::cout &lt;&lt; \"formatter&lt;Index>()\\n\"; }      constexpr auto parse(std::format_parse_context&amp; ctx) {         return ctx.begin();     }      auto format(const Index&amp; id, std::format_context&amp; ctx) {         return std::format_to(ctx.out(), \"{}\", id.id_);     } };<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code>Index id{ 100 }; std::cout &lt;&lt; std::format(\"id {}\\n\", id); std::cout &lt;&lt; std::format(\"id duplicated {0} {0}\\n\", id);<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>formatter&lt;Index>() id 100 formatter&lt;Index>() formatter&lt;Index>() id duplicated 100 100<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>{0}<\/code> \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430, \u0430 \u043d\u0435 \u043e\u0434\u0438\u043d.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>parse()<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>\"{0}\"\u00a0 \u00a0 \u00a0 \/\/ ctx.begin() \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 `}` \"{0:d}\"\u00a0 \u00a0 \/\/ ctx.begin() \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 `d`, \u0430 begin-end \u2014 \"d}\" \"{:hello}\" \/\/ ctx.begin() \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 'h', \u0430 begin-end \u2014 \"hello}\"<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>parse()<\/code> \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u0441\u043a\u043e\u0431\u043a\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0435\u0435 \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 <code>ctx.begin()<\/code>.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 <code>{:hello}<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0442 <code>begin()<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 <code>}<\/code> \u0438, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u2014 \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u0447\u0442\u043e \u0431\u0443\u0434\u044c\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b!<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u0441 \u043e\u0434\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Index> : std::formatter&lt;int> {     auto format(const Index&amp; id, std::format_context&amp; ctx) {         return std::formatter&lt;int>::format(id.id_, ctx);     } };<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0438\u0432\u0430\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b:<\/p>\n<pre><code>Index id{ 100 }; std::cout &lt;&lt; std::format(\"id {:*&lt;11d}\\n\", id); std::cout &lt;&lt; std::format(\"id {:*^11d}\\n\", id);<\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>id 100******** id ****100****<\/code><\/pre>\n<h4>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u00a0\u00a0<\/h4>\n<p>\u0410 \u0447\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:<\/p>\n<pre><code>struct Color {     uint8_t r{ 0 };     uint8_t g{ 0 };     uint8_t b{ 0 }; };<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Color> {     constexpr auto parse(std::format_parse_context&amp; ctx) {         return ctx.begin();     }      auto format(const Color&amp; col, std::format_context&amp; ctx) {         return std::format_to(ctx.out(), \"({}, {}, {})\", col.r, col.g, col.b);     } };<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 \u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0430.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440 <code>string_view<\/code>:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Color> : std::formatter&lt;string_view> {     auto format(const Color&amp; col, std::format_context&amp; ctx) {         std::string temp;         std::format_to(std::back_inserter(temp), \"({}, {}, {})\",                         col.r, col.g, col.b);         return std::formatter&lt;string_view>::format(temp, ctx);     } };<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>parse()<\/code> \u0441 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c \u0432\u044b\u0448\u0435 \u043a\u043e\u0434\u043e\u043c. \u0412\u043d\u0443\u0442\u0440\u0438 <code>format()<\/code> \u043c\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;YourType> : std::formatter&lt;string_view> {     auto format(const YourType&amp; obj, std::format_context&amp; ctx) {         std::string temp;         std::format_to(std::back_inserter(temp), \"{} - \", obj.GetName());          for (const auto&amp; elem : obj.GetValues())             std::format_to(std::back_inserter(temp), \"{}, \", elem);          return std::formatter&lt;string_view>::format(temp, ctx);     } };<\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 <code>obj.GetName()<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 <code>obj.GetValues()<\/code>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>string_view<\/code> \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430, \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0430.<\/p>\n<h3>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 parse() \u00a0\u00a0\u00a0<\/h3>\n<p>\u041d\u043e \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430?<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 <code>*this<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 format.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Color> {     constexpr auto parse(std::format_parse_context&amp; ctx){         auto pos = ctx.begin();         while (pos != ctx.end() &amp;&amp; *pos != '}') {             if (*pos == 'h' || *pos == 'H')                 isHex_ = true;             ++pos;         }         return pos;  \/\/ \u0412 \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f `}`, \u0438\u043d\u0430\u0447\u0435                       \/\/ \u044d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430! \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435!     }      auto format(const Color&amp; col, std::format_context&amp; ctx) {         if (isHex_) {             uint32_t val = col.r &lt;&lt; 16 | col.g &lt;&lt; 8 | col.b;             return std::format_to(ctx.out(), \"#{:x}\", val);         }                  return std::format_to(ctx.out(), \"({}, {}, {})\", col.r, col.g, col.b);     }      bool isHex_{ false }; };<\/code><\/pre>\n<p>\u0418 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code>std::cout &lt;&lt; std::format(\"col {}\\n\", Color{ 100, 200, 255 }); std::cout &lt;&lt; std::format(\"col {:h}\\n\", Color{ 100, 200, 255 });<\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>col (100, 200, 255) col #64c8ff<\/code><\/pre>\n<h3>\u0420\u0435\u0437\u044e\u043c\u0435<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0432 <code>std::format<\/code>, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f <code>std::formatter<\/code>. \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>parse()<\/code> \u0438 <code>format()<\/code>. \u041f\u0435\u0440\u0432\u0430\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 <code>*this<\/code>, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u0444\u0435\u0440 out, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0425\u043e\u0442\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u0441 <code>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c &lt;&lt;<\/code>, \u043e\u043d \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438. \u0412 \u0441\u0430\u043c\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u043e\u0432.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432 <a href=\"https:\/\/godbolt.org\/z\/Mh6dbfEq9\">Compiler Explorer<\/a>.<\/p>\n<p>\u0412 Visual Studio 2022 \u0432\u0435\u0440\u0441\u0438\u0438 17.2 \u0438 Visual Studio 2019 \u0432\u0435\u0440\u0441\u0438\u0438 16.11.14 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>std:c++20<\/code>, \u043d\u043e \u0432 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>\/std:latest<\/code> (\u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0441\u044f \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435). \u041f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043d\u0430 \u0438\u044e\u043b\u044c 2022 \u0433\u043e\u0434\u0430 GCC \u0435\u0449\u0435 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u044d\u0442\u0443 \u0444\u0438\u0447\u0443. Clang 14 \u0438\u043c\u0435\u0435\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043d\u043e \u043e\u043d\u0430 \u0435\u0449\u0435 \u043d\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0430.<\/p>\n<p><strong>\u0421\u0441\u044b\u043b\u043a\u0438<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/fmt.dev\/latest\/api.html#format-api\">\u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e API \u2014 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f fmt 8.1.0<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/wgml.pl\/blog\/formatting-user-defined-types-fmt.html\">\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0442\u0438\u043f\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 {fmt}<\/a> \u2014 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c <code>fmt::<\/code> \u043d\u0430 <code>std::<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e fmt \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u043c.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.cppstories.com\/2020\/02\/extra-format-cpp20.html\/#user-defined-types\">\u0412\u043d\u0435\u0437\u0435\u043c\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 C++20 \u2014 C++ Stories<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/leanpub.com\/cpp20\/\">C++20 \u2014 \u041f\u043e\u043b\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043e\u0442 Nicolai M. Josuttis<\/a> \u2014 \u0442\u0440\u044e\u043a\u0438 \u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/msvcs-stl-completes-stdc20\/\">MSVC\u2019s STL Completes \/std:c++20 &#8212; \u0411\u043b\u043e\u0433 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 C++<\/a><\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<blockquote>\n<p>\u0425\u043e\u0442\u044c \u0438 \u043c\u043e\u0434\u043d\u043e \u043a\u0440\u0438\u0442\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u041e\u041e\u041f-\u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043a\u043e\u0434\u0430, \u043e\u043d \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u0444\u0435\u0440\u0430\u0445. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0437\u043d\u0430\u0442\u044c \u0438 \u043d\u0435 \u0443\u043c\u0435\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0432\u0435\u0436\u043b\u0438\u0432\u043e. \u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u0432\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u00ab<strong>\u041e\u041e\u041f \u0433\u043b\u0430\u0437\u0430\u043c\u0438 C++<\/strong>\u00bb, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445, \u043a\u0430\u043a \u0442\u0435\u0440\u043c\u0438\u043d\u044b \u041e\u041e\u041f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u044f\u0437\u044b\u043a\u0430 C++.<\/p>\n<p><a href=\"https:\/\/otus.pw\/KJPE\/\"><strong>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0437\u0430\u043d\u044f\u0442\u0438\u0435.<\/strong><\/a><\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/686900\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/686900\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><code>std::format<\/code> \u2014 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 (\u0438 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435) \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 C++20, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u043d\u0430\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041e\u043d\u043e \u043f\u0440\u0438\u0432\u043d\u043e\u0441\u0438\u0442 \u0432 \u044f\u0437\u044b\u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0441\u0442\u0438\u043b\u0435 Python \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u044b) \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u043e\u0432\u043e\u0439 <code>std::format<\/code> \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439.<\/p>\n<h3>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 std::format \u00a0\u00a0\u00a0<\/h3>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u044d\u0442\u043e\u0442 Hello World:<\/p>\n<pre><code>#include &lt;format> #include &lt;iostream> #include &lt;chrono>  int main() {     auto ym = std::chrono::year { 2022 } \/ std::chrono::July;     std::string msg = std::format(\"{:*^10}\\n{:*>10}\\nin{}!\", \"hello\", \"world\", ym);     std::cout &lt;&lt; msg; }<\/code><\/pre>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 <a href=\"https:\/\/godbolt.org\/z\/3zaWjWsf9\">Compiler Explorer<\/a>.<\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>**hello*** *****world in2022\/Jul!<\/code><\/pre>\n<p>\u041c\u044b \u0437\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 <code>std::string<\/code>. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/format\/formatter#Standard_format_specification\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b<\/a> \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u043e\u043c (\u0442\u0438\u043f, \u0434\u043b\u0438\u043d\u0430, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0438 \u0442. \u0434.). \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0435\u0441\u0442\u043e\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c <code>{}<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (\u043a \u0441\u043b\u043e\u0432\u0443, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 <code>std::chrono<\/code>!). \u041f\u043e\u0437\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442-\u043f\u043e\u0442\u043e\u043a.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0438 \u0444\u0438\u0447\u0430\u0445 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c <a href=\"https:\/\/www.cppstories.com\/2020\/02\/extra-format-cpp20.html\/#user-defined-types\">\u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.\u00a0<\/p>\n<h3>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u044b \u00a0\u00a0\u00a0<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <code>std::format<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u044b:<\/p>\n<ul>\n<li>\n<p><code>char<\/code>, <code>wchar_t<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f <code>std::basic_string<\/code>, <code>std::basic_string_view<\/code>, \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0438\u043f\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438: <code>void*<\/code>, <code>const void*<\/code> \u0438 <code>nullptr_t<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 <code>formatter<\/code>, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u043e \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"https:\/\/timsong-cpp.github.io\/cppwp\/n4861\/format.formatter.spec\">[format.formatter.spec]<\/a>:<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u043c:<\/p>\n<pre><code>std::cout &lt;&lt; std::format(\"10 = {}, 42 = {:10}\\n\", 10, 42);<\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u0432\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430, \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u041d\u0430 \u043d\u0438\u0445 \u043b\u0435\u0436\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0438 \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u044b\u0432\u043e\u0434.<\/p>\n<p>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u043e\u0432:<\/p>\n<pre><code>template&lt;> struct formatter&lt;char, char>; template&lt;> struct formatter&lt;char, wchar_t>; template&lt;> struct formatter&lt;wchar_t, wchar_t>;<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 <code>charT<\/code>:<\/p>\n<pre><code>template&lt;> struct formatter&lt;charT*, charT>; template&lt;> struct formatter&lt;const charT*, charT>; template&lt;size_t N> struct formatter&lt;const charT[N], charT>; template&lt;class traits, class Allocator>   struct formatter&lt;basic_string&lt;charT, traits, Allocator>, charT>; template&lt;class traits>   struct formatter&lt;basic_string_view&lt;charT, traits>, charT>;<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e <code>charT<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e cv-\u043d\u0435\u043a\u0432\u0430\u043b\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 ArithmeticT, \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f <code>char<\/code>, <code>wchar_t<\/code>, <code>char8_t<\/code>, <code>char16_t<\/code> \u0438\u043b\u0438 <code>char32_t<\/code>, \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<pre><code>template&lt;> struct formatter&lt;ArithmeticT, charT>;<\/code><\/pre>\n<p>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 <code>charT<\/code>:<\/p>\n<pre><code>template&lt;> struct formatter&lt;nullptr_t, charT>; template&lt;> struct formatter&lt;void*, charT>; template&lt;> struct formatter&lt;const void*, charT>;<\/code><\/pre>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c:<\/p>\n<pre><code>int val = 10; std::cout &lt;&lt; std::format(\"val = {}, &amp;val = {}\\n\", val, &amp;val);<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0438 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 (\u043d\u0435 \u0441\u0430\u043c\u0443\u044e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0443\u044e, \u043d\u043e \u0437\u0430\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e):<\/p>\n<pre><code>auto std::make_format_args&lt;std::format_context,int,int*>(const int &amp;,int *const &amp;)'\u00a0  was being compiled and failed to find the required specializations (\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043d\u0435 \u0441\u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u044b\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439)...<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 <code>int*<\/code>, \u043d\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e <code>void*<\/code>. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e \u043e\u0431\u043e\u0439\u0442\u0438, \u043d\u0430\u043f\u0438\u0441\u0430\u0432:<\/p>\n<pre><code>int val = 10; std::cout &lt;&lt; std::format(\"val = {}, &amp;val = {}\\n\", val, static_cast&lt;void*>(&amp;val));\u00a0<\/code><\/pre>\n<p>\u0418 \u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 (MSVC, x64, Debug):<\/p>\n<pre><code>val = 10, &amp;val = 0xf5e64ff2c4<\/code><\/pre>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <code>{fmt}<\/code> \u0434\u0430\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043d\u043e \u0432 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435, \u0443\u0432\u044b, \u043d\u0435\u0442.<\/p>\n<pre><code>template&lt;typename T> auto fmt::ptr(T p) -> const void*<\/code><\/pre>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0430 \u0447\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432?<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <code>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 &lt;&lt;,<\/code> \u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041d\u043e \u0442\u0430\u043a \u0436\u0435 \u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f <code>std::format<\/code>?<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f.<\/p>\n<h3>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u044b \u00a0\u00a0\u00a0<\/h3>\n<p>\u0421 <code>std::format<\/code> \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e formatter\u2018\u0430 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;MyType> {     constexpr auto parse(std::format_parse_context&amp; ctx) {         return \/* *\/;     }      auto format(const MyType&amp; obj, std::format_context&amp; ctx) {         return std::format_to(ctx.out(), \/* *\/);     } };<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (\u0438\u0437 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430):<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"106\" width=\"106\">\n<p align=\"left\"><strong>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\"><strong>\u0422\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"106\" width=\"106\">\n<p align=\"left\">f.parse(pc)<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">PC::iterator<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0430\u0440\u0441\u0438\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 ([format.string]) \u0434\u043b\u044f \u0442\u0438\u043f\u0430 T \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 [pc.begin( ), pc.end()] \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043d\u0435\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430. \u0412\u044b\u0434\u0430\u0435\u0442 <code>format_error<\/code>, \u0435\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0435\u043d \u0432\u0435\u0441\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0435 \u201c}\u201d. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430\u043c \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0432 <code>*this<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430 \u043a\u043e\u043d\u0446\u043e\u043c \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"106\" width=\"106\">\n<p align=\"left\">f.format(t, fc)<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">FC::iterator<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u0435\u0442 t \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u0432 <code>*this<\/code>, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0432 <code>fc.out()<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430 \u043a\u043e\u043d\u0446\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430. \u0412\u044b\u0432\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 t, <code>fc.locale()<\/code> \u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 [<code>pc.begin()<\/code>, <code>pc.end()<\/code>] \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>f.parse(pc)<\/code>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0422\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u0447\u0435\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043b\u044f <code>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &lt;&lt;<\/code>, \u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u0432\u0443\u0447\u0438\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0442 \u043d\u0430\u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442.<\/p>\n<h4>\u041e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00a0\u00a0\u00a0\u00a0<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0438\u043f-\u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0441 \u043e\u0434\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code>struct Index {     unsigned int id_{ 0 }; };<\/code><\/pre>\n<p>\u0418 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Index> {     \/\/ \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0433\u0430     formatter() { std::cout &lt;&lt; \"formatter&lt;Index>()\\n\"; }      constexpr auto parse(std::format_parse_context&amp; ctx) {         return ctx.begin();     }      auto format(const Index&amp; id, std::format_context&amp; ctx) {         return std::format_to(ctx.out(), \"{}\", id.id_);     } };<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code>Index id{ 100 }; std::cout &lt;&lt; std::format(\"id {}\\n\", id); std::cout &lt;&lt; std::format(\"id duplicated {0} {0}\\n\", id);<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>formatter&lt;Index>() id 100 formatter&lt;Index>() formatter&lt;Index>() id duplicated 100 100<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>{0}<\/code> \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430, \u0430 \u043d\u0435 \u043e\u0434\u0438\u043d.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>parse()<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>\"{0}\"\u00a0 \u00a0 \u00a0 \/\/ ctx.begin() \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 `}` \"{0:d}\"\u00a0 \u00a0 \/\/ ctx.begin() \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 `d`, \u0430 begin-end \u2014 \"d}\" \"{:hello}\" \/\/ ctx.begin() \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 'h', \u0430 begin-end \u2014 \"hello}\"<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>parse()<\/code> \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u0441\u043a\u043e\u0431\u043a\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0435\u0435 \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 <code>ctx.begin()<\/code>.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 <code>{:hello}<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0442 <code>begin()<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 <code>}<\/code> \u0438, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u2014 \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u0447\u0442\u043e \u0431\u0443\u0434\u044c\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b!<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u0441 \u043e\u0434\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Index> : std::formatter&lt;int> {     auto format(const Index&amp; id, std::format_context&amp; ctx) {         return std::formatter&lt;int>::format(id.id_, ctx);     } };<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0440\u0430\u0441\u043f\u0430\u0440\u0448\u0438\u0432\u0430\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b:<\/p>\n<pre><code>Index id{ 100 }; std::cout &lt;&lt; std::format(\"id {:*&lt;11d}\\n\", id); std::cout &lt;&lt; std::format(\"id {:*^11d}\\n\", id);<\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>id 100******** id ****100****<\/code><\/pre>\n<h4>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u00a0\u00a0<\/h4>\n<p>\u0410 \u0447\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:<\/p>\n<pre><code>struct Color {     uint8_t r{ 0 };     uint8_t g{ 0 };     uint8_t b{ 0 }; };<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Color> {     constexpr auto parse(std::format_parse_context&amp; ctx) {         return ctx.begin();     }      auto format(const Color&amp; col, std::format_context&amp; ctx) {         return std::format_to(ctx.out(), \"({}, {}, {})\", col.r, col.g, col.b);     } };<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 \u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0430.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440 <code>string_view<\/code>:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Color> : std::formatter&lt;string_view> {     auto format(const Color&amp; col, std::format_context&amp; ctx) {         std::string temp;         std::format_to(std::back_inserter(temp), \"({}, {}, {})\",                         col.r, col.g, col.b);         return std::formatter&lt;string_view>::format(temp, ctx);     } };<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>parse()<\/code> \u0441 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c \u0432\u044b\u0448\u0435 \u043a\u043e\u0434\u043e\u043c. \u0412\u043d\u0443\u0442\u0440\u0438 <code>format()<\/code> \u043c\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;YourType> : std::formatter&lt;string_view> {     auto format(const YourType&amp; obj, std::format_context&amp; ctx) {         std::string temp;         std::format_to(std::back_inserter(temp), \"{} - \", obj.GetName());          for (const auto&amp; elem : obj.GetValues())             std::format_to(std::back_inserter(temp), \"{}, \", elem);          return std::formatter&lt;string_view>::format(temp, ctx);     } };<\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 <code>obj.GetName()<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 <code>obj.GetValues()<\/code>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>string_view<\/code> \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430, \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0430.<\/p>\n<h3>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 parse() \u00a0\u00a0\u00a0<\/h3>\n<p>\u041d\u043e \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430?<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 <code>*this<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 format.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c:<\/p>\n<pre><code>template &lt;> struct std::formatter&lt;Color> {     constexpr auto parse(std::format_parse_context&amp; ctx){         auto pos = ctx.begin();         while (pos != ctx.end() &amp;&amp; *pos != '}') {             if (*pos == 'h' || *pos == 'H')                 isHex_ = true;             ++pos;         }         return pos;  \/\/ \u0412 \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f `}`, \u0438\u043d\u0430\u0447\u0435                       \/\/ \u044d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430! \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435!     }      auto format(const Color&amp; col,<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-338078","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=338078"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338078\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}