{"id":4748,"date":"2025-03-27T23:06:06","date_gmt":"2025-03-27T21:06:06","guid":{"rendered":"https:\/\/mariusbancila.ro\/blog\/?p=4748"},"modified":"2025-03-27T23:06:09","modified_gmt":"2025-03-27T21:06:09","slug":"whats-new-in-cpp26-part-2","status":"publish","type":"post","link":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/","title":{"rendered":"What\u2019s new in C++26 (part 2)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In a previous <a href=\"https:\/\/mariusbancila.ro\/blog\/2024\/09\/06\/whats-new-in-c26-part-1\/\" target=\"_blank\" rel=\"noopener\" title=\"\">blog post<\/a>, I talked about several features included in C++26: specifying a reason to delete a function, placeholder variables with no name, structured binding declaration as a condition, and user-generated static_assert messages. In this post, I will continue exploring the new features that have been already included in the C++26 standard.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">#embed<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>#embed<\/code> is a new preprocessor directive that works as <code>#include<\/code> but for binary data. Its motivation is pretty simple: developers often need to include resources in their application (encoded text, images, sound, video) etc. but there is no standard or common way to do so. In this context, a resource is any source of data that is accessible during compilation. The <code>#embed<\/code> directive is replaced with a comma-separated list of <code>int<\/code> literals.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">constexpr unsigned char icon_resource[] =\n{\n#embed \"app.ico\"\n};\n\nconstexpr std::vector&lt;unsigned char> sound_resource\n{\n#embed \"sound.wav\"\n};<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">There are several parameters that can be specified for <code>#embed<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>limit<\/code>: defines an upper limit for the size of the resource to be embedded<\/li><li><code>prefix<\/code>: adds the specified prefix to the embedded resource, but only if it is not empty<\/li><li><code>suffix<\/code>: adds the specified suffix to the embedded resource, but only if it is not empty<\/li><li><code>if_empty<\/code>: replaces the embedded resource with the specified data if the resource is empty<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The following are two examples (the first taken from the proposal paper) for using these parameters:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">constexpr unsigned char null_terminated_file_data[] = {\n  #embed \"might_be_empty.txt\" \\\n    prefix(0xEF, 0xBB, 0xBF, ) \/* UTF-8 BOM *\/ \\\n    suffix(,)\n  0 \/\/ always null-terminated\n};\n\nconstexpr unsigned char image[] = \n{\n  #embed \"brush.bmp\" if_empty(0xBAADF00D)\n};<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can read more about <code>#embed<\/code> here:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2025\/p1967r14.html\" target=\"_blank\" rel=\"noopener\" title=\"\">P1967R14 #embed &#8211; a scannable, tooling-friendly binary resource inclusion mechanism<\/a><\/li><li><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/preprocessor\/embed\" target=\"_blank\" rel=\"noopener\" title=\"\">Resource inclusion<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">constexpr exceptions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Throwing exceptions in constant evaluated code has not been possible. This makes it hard in some cases to do error handling and report errors. C++26 relaxes constraints on constant expressions, allowing throw statements. Moreover, standard exception classes are now <code>constexpr<\/code>, so you can throw them from constant evaluated code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is an example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">constexpr time parse_time(std::string_view input) {\n   auto [correct, hh, mm, ss] = ctre::match&lt;\"([01]\\d|2[0-3]):([0-5]\\d):([0-5]\\d)\">(input);\n\t\n   if (!correct) {\n      throw std::exception(\"invalid time format\");\n   }\n\n   return build_time(hh, mm, ss);\n}\n\nint main()\n{\n   try\n   {\n      constexpr time t1 = parse_time(\"12:30:59\");  \/\/ [1]\n      constexpr time t2 = parse_time(\"12:30:60\");  \/\/ [2]\n   }\n   catch(std::exception const &amp; e) {\n   }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Previously, both calls at <code>[1]<\/code> and <code>[2]<\/code> would have resulted in a compile-time error due to the fact that throwing exceptions from <code>constexpr<\/code> functions was not possible. With these changes in C++26:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>call at <code>[1]<\/code> is correct, no errors occur<\/li><li>call at <code>[2]<\/code> produces a compile-time error with the text &#8220;invalid time format&#8221;<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">It is important to note that even though throwing exceptions from constant evaluated code is now possible, it is mandatory to catch the possible thrown exceptions. Otherwise, a compile-time error is generated due to the uncaught exception.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">constexpr time t1 = parse_time(\"12:30:59\");  \/\/ compile time error because exceptions are uncaught<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To learn more about this feature see:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2024\/p3068r6.html\" target=\"_blank\" rel=\"noopener\" title=\"\">P3068R6 Allowing exception throwing in constant-evaluation<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Variadic friends<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Class templates can grant access to their private and protected members to template parameter classes.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">template&lt;typename K, typename V>\nclass D {\n  friend K;\n  friend V;\n};<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">However, doing the same for all classes in a parameter pack was not possible.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">template &lt;typename... T>\nclass D {\n    friend T...;\n};<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">C++26 makes the above snippet possible. Here is another example from the proposal paper, with nested classes:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">template&lt;class T>\nstruct C {\n  template&lt;class U> struct Nested;\n};\n \ntemplate&lt;class... Ts>\nstruct VS {\n  template&lt;class U>\n  friend class C&lt;Ts>::Nested...; \/\/ OK\n};<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Variadic friends can be useful in situations such as the CRTP with multiple base classes or granting access to individual member functions using the <a href=\"https:\/\/accu.org\/journals\/overload\/31\/176\/mertz\/\" target=\"_blank\" rel=\"noopener\" title=\"\">passkey idiom<\/a>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To learn more about this topic see:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2024\/p2893r3.html\" target=\"_blank\" rel=\"noopener\" title=\"\">P2893R3 Variadic friends<\/a><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You can check the support for this features with different compiler on cppreference: <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/26\" target=\"_blank\" rel=\"noopener\" title=\"\">C++26<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a previous blog post, I talked about several features included in C++26: specifying a reason to delete a function, placeholder variables with no name, structured binding declaration as a condition, and user-generated static_assert messages. In this post, I will continue exploring the new features that have been already included in the C++26 standard. #embed &#8230; <a title=\"What\u2019s new in C++26 (part 2)\" class=\"read-more\" href=\"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/\" aria-label=\"Read more about What\u2019s new in C++26 (part 2)\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[7],"tags":[451,647],"class_list":["post-4748","post","type-post","status-publish","format-standard","hentry","category-c","tag-c","tag-c26"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Marius Bancila\"\/>\n\t<meta name=\"keywords\" content=\"c++,c++26\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Marius Bancila&#039;s Blog | About code. Mostly on C++\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"What\u2019s new in C++26 (part 2)\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2025-03-27T21:06:06+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2025-03-27T21:06:09+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"What\u2019s new in C++26 (part 2)\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#article\",\"name\":\"What\\u2019s new in C++26 (part 2)\",\"headline\":\"What\\u2019s new in C++26 (part 2)\",\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"},\"datePublished\":\"2025-03-27T23:06:06+02:00\",\"dateModified\":\"2025-03-27T23:06:09+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#webpage\"},\"articleSection\":\"C++, C++, C++26\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"position\":2,\"name\":\"IT\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"position\":3,\"name\":\"Software\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"name\":\"C++\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"position\":4,\"name\":\"C++\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#listItem\",\"name\":\"What\\u2019s new in C++26 (part 2)\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#listItem\",\"position\":5,\"name\":\"What\\u2019s new in C++26 (part 2)\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"name\":\"C++\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Marius Bancila\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Marius Bancila\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#webpage\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/\",\"name\":\"What\\u2019s new in C++26 (part 2)\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2025\\\/03\\\/27\\\/whats-new-in-cpp26-part-2\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2025-03-27T23:06:06+02:00\",\"dateModified\":\"2025-03-27T23:06:09+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"What\u2019s new in C++26 (part 2)","description":"","canonical_url":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/","robots":"max-image-preview:large","keywords":"c++,c++26","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#article","name":"What\u2019s new in C++26 (part 2)","headline":"What\u2019s new in C++26 (part 2)","author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"},"datePublished":"2025-03-27T23:06:06+02:00","dateModified":"2025-03-27T23:06:09+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#webpage"},"isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#webpage"},"articleSection":"C++, C++, C++26"},{"@type":"BreadcrumbList","@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog#listItem","position":1,"name":"Home","item":"https:\/\/mariusbancila.ro\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","position":2,"name":"IT","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","position":3,"name":"Software","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","name":"C++"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","position":4,"name":"C++","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#listItem","name":"What\u2019s new in C++26 (part 2)"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#listItem","position":5,"name":"What\u2019s new in C++26 (part 2)","previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","name":"C++"}}]},{"@type":"Organization","@id":"https:\/\/mariusbancila.ro\/blog\/#organization","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","url":"https:\/\/mariusbancila.ro\/blog\/"},{"@type":"Person","@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author","url":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/","name":"Marius Bancila","image":{"@type":"ImageObject","@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g","width":96,"height":96,"caption":"Marius Bancila"}},{"@type":"WebPage","@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#webpage","url":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/","name":"What\u2019s new in C++26 (part 2)","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/#breadcrumblist"},"author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"datePublished":"2025-03-27T23:06:06+02:00","dateModified":"2025-03-27T23:06:09+02:00"},{"@type":"WebSite","@id":"https:\/\/mariusbancila.ro\/blog\/#website","url":"https:\/\/mariusbancila.ro\/blog\/","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","inLanguage":"en-US","publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Marius Bancila's Blog | About code. Mostly on C++","og:type":"article","og:title":"What\u2019s new in C++26 (part 2)","og:url":"https:\/\/mariusbancila.ro\/blog\/2025\/03\/27\/whats-new-in-cpp26-part-2\/","article:published_time":"2025-03-27T21:06:06+00:00","article:modified_time":"2025-03-27T21:06:09+00:00","twitter:card":"summary","twitter:title":"What\u2019s new in C++26 (part 2)"},"aioseo_meta_data":{"post_id":"4748","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2025-03-27 19:07:53","updated":"2025-12-12 07:59:22","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"author_meta":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"featured_img":null,"jetpack_publicize_connections":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"In a previous blog post, I talked about several features included in C++26: specifying a reason to delete a function, placeholder variables with no name, structured binding declaration as a condition, and user-generated static_assert messages. In this post, I will continue exploring the new features that have been already included in the C++26 standard. #embed&hellip;","coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">C++<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">C++<\/span>"]},"tags":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">C++<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">C++26<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">C++<\/span>","<span class=\"advgb-post-tax-term\">C++26<\/span>"]}},"comment_count":"0","relative_dates":{"created":"Posted 2 years ago","modified":"Updated 2 years ago"},"absolute_dates":{"created":"Posted on March 27, 2025","modified":"Updated on March 27, 2025"},"absolute_dates_time":{"created":"Posted on March 27, 2025 11:06 pm","modified":"Updated on March 27, 2025 11:06 pm"},"featured_img_caption":"","series_order":"","jetpack_shortlink":"https:\/\/wp.me\/pYNdv-1eA","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/4748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/comments?post=4748"}],"version-history":[{"count":6,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/4748\/revisions"}],"predecessor-version":[{"id":4754,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/4748\/revisions\/4754"}],"wp:attachment":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/media?parent=4748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/categories?post=4748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/tags?post=4748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}