{"id":5805,"date":"2019-10-28T11:15:45","date_gmt":"2019-10-28T11:15:45","guid":{"rendered":"https:\/\/www.modernescpp.com\/index.php\/c-20-the-library\/"},"modified":"2023-06-26T09:58:30","modified_gmt":"2023-06-26T09:58:30","slug":"c-20-the-library","status":"publish","type":"post","link":"https:\/\/www.modernescpp.com\/index.php\/c-20-the-library\/","title":{"rendered":"C++20: The Library"},"content":{"rendered":"<p>My last post &#8220;<a href=\"http:\/\/bit.ly\/2PKLKge\">C++20: The Core Language<\/a>&#8221; presented the new features of the C++20 core language. Today, I continue my journey with an overview of the C++20 library.<strong class=\"manuell_vorspann\"> <br \/><\/strong><\/p>\n<p><!--more--><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-5803\" src=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2019\/10\/TimelineCpp20Libraries.png\" alt=\"TimelineCpp20Libraries\" width=\"650\" height=\"244\" style=\"display: block; margin-left: auto; margin-right: auto;\" srcset=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2019\/10\/TimelineCpp20Libraries.png 1080w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2019\/10\/TimelineCpp20Libraries-300x113.png 300w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2019\/10\/TimelineCpp20Libraries-1024x384.png 1024w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2019\/10\/TimelineCpp20Libraries-768x288.png 768w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/>The image shows you my plan for today.<\/p>\n<\/p>\n<h2>Library<\/h2>\n<h3>Calendar and Time-Zone<\/h3>\n<p>The chrono library from C++11\/14 was extended with a calendar and time-zone facility.&nbsp; If you don&#8217;t know the Chrono library, read my posts to <a href=\"https:\/\/www.modernescpp.com\/index.php\/tag\/time\">time<\/a>.<\/p>\n<h4>Calendar<\/h4>\n<p>Calendar: consists of types, which represent a year, a month, a day of a weekday, and an n-th weekday of a month. These elementary types can be combined into complex types such for example <span style=\"font-family: courier new, courier;\">year_month, year_month_day, year_month_day_last, years_month_weekday,<\/span> and <span style=\"font-family: courier new, courier;\">year_month_weekday_last<\/span>. The operator &#8220;\/&#8221; is overloaded for the convenient specification of time points. Additionally, we will get new with C++20 literals: d for a day and y for a year.<\/p>\n<h4>Time-Zone<\/h4>\n<p>Time points can be displayed in various specific time zones.<\/p>\n<p>Due to the extended chrono library, the following use cases are easy to implement:<\/p>\n<ul>\n<li>representing dates in various forms<\/li>\n<\/ul>\n<div style=\"background: #f0f3f3; overflow: auto; width: auto; gray;border-width: .1em .1em .1em .8em;\">\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #006699; font-weight: bold;\">auto<\/span> d1 <span style=\"color: #555555;\">=<\/span> <span style=\"color: #ff6600;\">2019<\/span>y<span style=\"color: #555555;\">\/<\/span>oct<span style=\"color: #555555;\">\/<\/span><span style=\"color: #ff6600;\">28<\/span>;\r\n<span style=\"color: #006699; font-weight: bold;\">auto<\/span> d2 <span style=\"color: #555555;\">=<\/span> <span style=\"color: #ff6600;\">28<\/span>d<span style=\"color: #555555;\">\/<\/span>oct<span style=\"color: #555555;\">\/<\/span><span style=\"color: #ff6600;\">2019<\/span>;\r\n<span style=\"color: #006699; font-weight: bold;\">auto<\/span> d3 <span style=\"color: #555555;\">=<\/span> oct<span style=\"color: #555555;\">\/<\/span><span style=\"color: #ff6600;\">28<\/span><span style=\"color: #555555;\">\/<\/span><span style=\"color: #ff6600;\">2019<\/span>; <\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<ul>\n<li>get the last day of a month<\/li>\n<li>get the number of days between two dates<\/li>\n<li>printing the current time in various time-zones<\/li>\n<\/ul>\n<p>If you want to play with these features, use Howard Hinnards implementation on <a href=\"https:\/\/github.com\/HowardHinnant\/date\">GitHub.<\/a> Howard Hinnard, the author of the calendar and time-zone proposal, also created a playground for it on <a href=\"https:\/\/wandbox.org\/permlink\/vqwMyTphHJv5iXX7\">Wandbox.<\/a><\/p>\n<div style=\"background: #f0f3f3; overflow: auto; width: auto; gray;border-width: .1em .1em .1em .8em;\">\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #009999;\">#include \"date.h\"<\/span>\r\n<span style=\"color: #009999;\">#include &lt;iostream&gt;<\/span>\r\n\r\n<span style=\"color: #007788; font-weight: bold;\">int<\/span>\r\n<span style=\"color: #cc00ff;\">main<\/span>()\r\n{\r\n    <span style=\"color: #006699; font-weight: bold;\">using<\/span> <span style=\"color: #006699; font-weight: bold;\">namespace<\/span> date;\r\n    <span style=\"color: #006699; font-weight: bold;\">using<\/span> <span style=\"color: #006699; font-weight: bold;\">namespace<\/span> std<span style=\"color: #555555;\">::<\/span>chrono;\r\n    <span style=\"color: #006699; font-weight: bold;\">auto<\/span> now <span style=\"color: #555555;\">=<\/span> system_clock<span style=\"color: #555555;\">::<\/span>now();\r\n    std<span style=\"color: #555555;\">::<\/span>cout <span style=\"color: #555555;\">&lt;&lt;<\/span> <span style=\"color: #cc3300;\">\"The current time is \"<\/span> <span style=\"color: #555555;\">&lt;&lt;<\/span> now <span style=\"color: #555555;\">&lt;&lt;<\/span> <span style=\"color: #cc3300;\">\" UTC<\/span><span style=\"color: #cc3300; font-weight: bold;\">\\n<\/span><span style=\"color: #cc3300;\">\"<\/span>;\r\n    <span style=\"color: #006699; font-weight: bold;\">auto<\/span> current_year <span style=\"color: #555555;\">=<\/span> year_month_day{floor<span style=\"color: #555555;\">&lt;<\/span>days<span style=\"color: #555555;\">&gt;<\/span>(now)}.year();\r\n    std<span style=\"color: #555555;\">::<\/span>cout <span style=\"color: #555555;\">&lt;&lt;<\/span> <span style=\"color: #cc3300;\">\"The current year is \"<\/span> <span style=\"color: #555555;\">&lt;&lt;<\/span> current_year <span style=\"color: #555555;\">&lt;&lt;<\/span> <span style=\"color: #cc3300;\">'\\n'<\/span>;\r\n    <span style=\"color: #006699; font-weight: bold;\">auto<\/span> h <span style=\"color: #555555;\">=<\/span> floor<span style=\"color: #555555;\">&lt;<\/span>hours<span style=\"color: #555555;\">&gt;<\/span>(now) <span style=\"color: #555555;\">-<\/span> sys_days{jan<span style=\"color: #555555;\">\/<\/span><span style=\"color: #ff6600;\">1<\/span><span style=\"color: #555555;\">\/<\/span>current_year};\r\n    std<span style=\"color: #555555;\">::<\/span>cout <span style=\"color: #555555;\">&lt;&lt;<\/span> <span style=\"color: #cc3300;\">\"It has been \"<\/span> <span style=\"color: #555555;\">&lt;&lt;<\/span> h <span style=\"color: #555555;\">&lt;&lt;<\/span> <span style=\"color: #cc3300;\">\" since New Years!<\/span><span style=\"color: #cc3300; font-weight: bold;\">\\n<\/span><span style=\"color: #cc3300;\">\"<\/span>;\r\n}\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Of course, C++20 uses the <span style=\"font-family: courier new, courier;\">std::chrono<\/span> namespace instead of the <span style=\"font-family: courier new, courier;\">date<\/span> namespace. Here is the output of the program:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-5804\" src=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2019\/10\/calendar.png\" alt=\"calendar\" width=\"400\" height=\"146\" style=\"display: block; margin-left: auto; margin-right: auto;\" srcset=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2019\/10\/calendar.png 448w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2019\/10\/calendar-300x110.png 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"font-family: courier new, courier;\">std::span<\/span><\/h3>\n<p>A <span style=\"font-family: courier new, courier;\">std::span<\/span> is an object that can refer to a contiguous sequence of objects. A std::span, sometimes also called a view, is never an owner. This contiguous memory can be an array, a pointer with a size, or a <span style=\"font-family: courier new, courier;\">std::vector<\/span>. A typical implementation needs a pointer to its first element and a size. The main reason for having a <span style=\"font-family: courier new, courier;\">std::span&lt;T&gt;<\/span> is that a plain array will decay to a pointer if passed to a function; therefore, the size is lost. <span style=\"font-family: courier new, courier;\">std<strong>:<\/strong>:span&lt;T&gt;<\/span> automatically deduces the size of the plain array or the <span style=\"font-family: courier new, courier;\">std::vector.<\/span> If you use a pointer to initialize a <code>std::span&lt;T&gt;<\/code>, you must provide the constructor&#8217;s size.<\/p>\n<div style=\"background: #f0f3f3; overflow: auto; width: auto; gray;border-width: .1em .1em .1em .8em;\">\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #006699; font-weight: bold;\">template<\/span> <span style=\"color: #555555;\">&lt;<\/span><span style=\"color: #006699; font-weight: bold;\">typename<\/span> T<span style=\"color: #555555;\">&gt;<\/span>\r\n<span style=\"color: #007788; font-weight: bold;\">void<\/span> copy_n(<span style=\"color: #006699; font-weight: bold;\">const<\/span> T<span style=\"color: #555555;\">*<\/span> p, T<span style=\"color: #555555;\">*<\/span> q, <span style=\"color: #007788; font-weight: bold;\">int<\/span> n){}\r\n\r\n<span style=\"color: #006699; font-weight: bold;\">template<\/span> <span style=\"color: #555555;\">&lt;<\/span><span style=\"color: #006699; font-weight: bold;\">typename<\/span> T<span style=\"color: #555555;\">&gt;<\/span>\r\n<span style=\"color: #007788; font-weight: bold;\">void<\/span> copy(std<span style=\"color: #555555;\">::<\/span>span<span style=\"color: #555555;\">&lt;<\/span><span style=\"color: #006699; font-weight: bold;\">const<\/span> T<span style=\"color: #555555;\">&gt;<\/span> src, std<span style=\"color: #555555;\">::<\/span>span<span style=\"color: #555555;\">&lt;<\/span>T<span style=\"color: #555555;\">&gt;<\/span> des){}\r\n\r\n<span style=\"color: #007788; font-weight: bold;\">int<\/span> main(){\r\n    \r\n  <span style=\"color: #007788; font-weight: bold;\">int<\/span> arr1[] <span style=\"color: #555555;\">=<\/span> {<span style=\"color: #ff6600;\">1<\/span>, <span style=\"color: #ff6600;\">2<\/span>, <span style=\"color: #ff6600;\">3<\/span>};\r\n  <span style=\"color: #007788; font-weight: bold;\">int<\/span> arr2[] <span style=\"color: #555555;\">=<\/span> {<span style=\"color: #ff6600;\">3<\/span>, <span style=\"color: #ff6600;\">4<\/span>, <span style=\"color: #ff6600;\">5<\/span>};\r\n  \r\n  copy_n(arr1, arr2, <span style=\"color: #ff6600;\">3<\/span>);         <span style=\"color: #0099ff; font-style: italic;\">\/\/ (1)<\/span>\r\n  copy(arr1, arr2);              <span style=\"color: #0099ff; font-style: italic;\">\/\/ (2)<\/span>\r\n    \r\n}\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>In contrast to the function<span style=\"font-family: courier new, courier;\"> copy_n<\/span> (1), <span style=\"font-family: courier new, courier;\">copy<\/span> (2) doesn&#8217;t need the number of elements. Hence, a common cause of errors is gone with <span style=\"font-family: courier new, courier;\">std::span&lt;T&gt;<\/span>.<\/p>\n<h3>constexpr Containers<\/h3>\n<p>C++ becomes more and more <span style=\"font-family: courier new, courier;\">constexpr. <\/span>For example, many algorithms of the Standard Template Library get with C++20 a <span style=\"font-family: courier new, courier;\">constexpr<\/span> overload.&nbsp; constexpr for a function or function template means that it could be performed at compile time. The question is now, which containers can be used at compile time? With C++20, the answer is <span style=\"font-family: courier new, courier;\">std::string<\/span> and <span style=\"font-family: courier new, courier;\">std::vector<\/span>.<\/p>\n<p>Before C++20, both could not be used in a constexpr evaluation because of three limiting aspects.<\/p>\n<ol>\n<li>Destructors couldn&#8217;t be <span style=\"font-family: courier new, courier;\">constexpr.<\/span><\/li>\n<li>Dynamic memory allocation\/deallocation wasn&#8217;t available.<\/li>\n<li>In-place construction using placement-new wasn&#8217;t available.<\/li>\n<\/ol>\n<p>These limiting aspects are now solved.<\/p>\n<p>Point 3 talks about placement-new, which is quite unknown. Placement-new is often used to instantiate an object in a pre-reserved memory area. Besides, you can overload placement-new globally or for your data types.<\/p>\n<div style=\"background: #f0f3f3; overflow: auto; width: auto; gray;border-width: .1em .1em .1em .8em;\">\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #007788; font-weight: bold;\">char<\/span><span style=\"color: #555555;\">*<\/span> memory <span style=\"color: #555555;\">=<\/span> <span style=\"color: #006699; font-weight: bold;\">new<\/span> <span style=\"color: #007788; font-weight: bold;\">char<\/span>[<span style=\"color: #006699; font-weight: bold;\">sizeof<\/span>(Account)];        <span style=\"color: #0099ff; font-style: italic;\">\/\/ allocate memory<\/span>\r\nAccount<span style=\"color: #555555;\">*<\/span> account <span style=\"color: #555555;\">=<\/span> <span style=\"color: #006699; font-weight: bold;\">new<\/span>(memory) Account;          <span style=\"color: #0099ff; font-style: italic;\">\/\/ construct in-place<\/span>\r\naccount<span style=\"color: #555555;\">-&gt;~<\/span>Account();                             <span style=\"color: #0099ff; font-style: italic;\">\/\/ destruct<\/span>\r\n<span style=\"color: #006699; font-weight: bold;\">delete [] memory;<\/span>                                <span style=\"color: #0099ff; font-style: italic;\">\/\/ free memory<\/span>\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Here are the steps to use placement-new. The first line allocates memory for an <span style=\"font-family: courier new, courier;\">Account,<\/span> which is used in the second line to construct an <span style=\"font-family: courier new, courier;\">account<\/span> in place. Admittedly, the expression <span style=\"font-family: courier new, courier;\">account-&gt;~Account()<\/span> looks strange. This expression is one of these rare cases in which you must explicitly call the destructor. Finally, the last line frees the memory.<\/p>\n<p>I will not go further into the details of <span style=\"font-family: 'courier new', courier;\">constexpr<\/span> Containers. If you are curious, read proposal <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0784r1.html\">784R1<\/a>.<\/p>\n<h3><span style=\"font-family: courier new, courier;\">std::format<\/span><\/h3>\n<p><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/format\">cppreference.com\/<\/a>concisely describes the new formatting library: &#8220;The text formatting library offers a safe and extensible alternative to the <span style=\"font-family: courier new, courier;\">printf<\/span> family of functions. It is intended to complement the existing C++ I\/O streams library and reuse some of its infrastructure such as overloaded insertion operators for user-defined types.&#8221;. This concise description includes a straightforward example:<\/p>\n<div style=\"background: #f0f3f3; overflow: auto; width: auto; gray;border-width: .1em .1em .1em .8em;\">\n<pre style=\"margin: 0; line-height: 125%;\">std<span style=\"color: #555555;\">::<\/span>string message <span style=\"color: #555555;\">=<\/span> std<span style=\"color: #555555;\">::<\/span>format(<span style=\"color: #cc3300;\">\"The answer is {}.\"<\/span>, <span style=\"color: #ff6600;\">42<\/span>);\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Maybe, this reminds you of Pythons format string. You are right. There is already an implementation of the <span style=\"font-family: courier new, courier;\">std::format<\/span> on GitHub available: <a href=\"https:\/\/github.com\/fmtlib\/fmt\">fmt.<\/a> Here are a few examples from the mentioned implementation. Instead of <span style=\"font-family: courier new, courier;\">std,<\/span> it uses the namespace <span style=\"font-family: courier new, courier;\">fmt.<\/span><\/p>\n<ul>\n<li>Format and use positional arguments<\/li>\n<\/ul>\n<div style=\"background: #f0f3f3; overflow: auto; width: auto; gray;border-width: .1em .1em .1em .8em;\">\n<pre style=\"margin: 0; line-height: 125%;\">std<span style=\"color: #555555;\">::<\/span>string s <span style=\"color: #555555;\">=<\/span> fmt<span style=\"color: #555555;\">::<\/span>format(<span style=\"color: #cc3300;\">\"I'd rather be {1} than {0}.\"<\/span>, <span style=\"color: #cc3300;\">\"right\"<\/span>, <span style=\"color: #cc3300;\">\"happy\"<\/span>);\r\n<span style=\"color: #0099ff; font-style: italic;\">\/\/ s == \"I'd rather be happy than right.\"<\/span>\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<ul>\n<li>&nbsp;Convert an integer to a string in a safe way<\/li>\n<\/ul>\n<div style=\"background: #f0f3f3; overflow: auto; width: auto; gray;border-width: .1em .1em .1em .8em;\">\n<pre style=\"margin: 0; line-height: 125%;\">fmt<span style=\"color: #555555;\">::<\/span>memory_buffer buf;\r\nformat_to(buf, <span style=\"color: #cc3300;\">\"{}\"<\/span>, <span style=\"color: #ff6600;\">42<\/span>);    <span style=\"color: #0099ff; font-style: italic;\">\/\/ replaces itoa(42, buffer, 10)<\/span>\r\nformat_to(buf, <span style=\"color: #cc3300;\">\"{:x}\"<\/span>, <span style=\"color: #ff6600;\">42<\/span>);  <span style=\"color: #0099ff; font-style: italic;\">\/\/ replaces itoa(42, buffer, 16)<\/span>\r\n<span style=\"color: #0099ff; font-style: italic;\">\/\/ access the string with to_string(buf) or buf.data()<\/span>\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<ul>\n<li>Format user-defined types<\/li>\n<\/ul>\n<div style=\"background: #f0f3f3; overflow: auto; width: auto; gray;border-width: .1em .1em .1em .8em;\">\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #006699; font-weight: bold;\">struct<\/span> date {\r\n  <span style=\"color: #007788; font-weight: bold;\">int<\/span> year, month, day;\r\n};\r\n\r\n<span style=\"color: #006699; font-weight: bold;\">template<\/span> <span style=\"color: #555555;\">&lt;&gt;<\/span>\r\n<span style=\"color: #006699; font-weight: bold;\">struct<\/span> fmt<span style=\"color: #555555;\">::<\/span>formatter<span style=\"color: #555555;\">&lt;<\/span>date<span style=\"color: #555555;\">&gt;<\/span> {\r\n  <span style=\"color: #006699; font-weight: bold;\">template<\/span> <span style=\"color: #555555;\">&lt;<\/span><span style=\"color: #006699; font-weight: bold;\">typename<\/span> ParseContext<span style=\"color: #555555;\">&gt;<\/span>\r\n  constexpr <span style=\"color: #006699; font-weight: bold;\">auto<\/span> parse(ParseContext <span style=\"color: #555555;\">&amp;<\/span>ctx) { <span style=\"color: #006699; font-weight: bold;\">return<\/span> ctx.begin(); }\r\n\r\n  <span style=\"color: #006699; font-weight: bold;\">template<\/span> <span style=\"color: #555555;\">&lt;<\/span><span style=\"color: #006699; font-weight: bold;\">typename<\/span> FormatContext<span style=\"color: #555555;\">&gt;<\/span>\r\n  <span style=\"color: #006699; font-weight: bold;\">auto<\/span> format(<span style=\"color: #006699; font-weight: bold;\">const<\/span> date <span style=\"color: #555555;\">&amp;<\/span>d, FormatContext <span style=\"color: #555555;\">&amp;<\/span>ctx) {\r\n    <span style=\"color: #006699; font-weight: bold;\">return<\/span> format_to(ctx.out(), <span style=\"color: #cc3300;\">\"{}-{}-{}\"<\/span>, d.year, d.month, d.day);\r\n  }\r\n};\r\n\r\nstd<span style=\"color: #555555;\">::<\/span>string s <span style=\"color: #555555;\">=<\/span> fmt<span style=\"color: #555555;\">::<\/span>format(<span style=\"color: #cc3300;\">\"The date is {}\"<\/span>, date{<span style=\"color: #ff6600;\">2012<\/span>, <span style=\"color: #ff6600;\">12<\/span>, <span style=\"color: #ff6600;\">9<\/span>});\r\n<span style=\"color: #0099ff; font-style: italic;\">\/\/ s == \"The date is 2012-12-9\"<\/span>\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<h2>What&#8217;s next?<\/h2>\n<p>&nbsp;<\/p>\n<p>As promised, I will dive deeper into a future post in the library. But first, I have to finish my high-level overview of C++20. My <a href=\"https:\/\/www.modernescpp.com\/index.php\/c-20-concurrency\">next post<\/a> is about the concurrency features.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>My last post &#8220;C++20: The Core Language&#8221; presented the new features of the C++20 core language. Today, I continue my journey with an overview of the C++20 library.<\/p>\n","protected":false},"author":21,"featured_media":5803,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[375],"tags":[453,463],"class_list":["post-5805","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-20","tag-time","tag-string"],"_links":{"self":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts\/5805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/comments?post=5805"}],"version-history":[{"count":1,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts\/5805\/revisions"}],"predecessor-version":[{"id":6767,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts\/5805\/revisions\/6767"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/media\/5803"}],"wp:attachment":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/media?parent=5805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/categories?post=5805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/tags?post=5805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}