{"id":13249,"date":"2023-03-01T15:20:34","date_gmt":"2023-03-01T15:20:34","guid":{"rendered":"https:\/\/digitalgateamg.com\/?p=13249"},"modified":"2023-08-08T14:43:03","modified_gmt":"2023-08-08T14:43:03","slug":"important-new-c-features","status":"publish","type":"post","link":"https:\/\/digitalgateamg.com\/de\/blog\/2023\/03\/01\/important-new-c-features\/","title":{"rendered":"Important New C++ Features"},"content":{"rendered":"<p>C++ 20 and 23 have a lot of new features which can reduce boilerplate code, increase e\ufb00iciency and make the code drastically more readable. Not only they can be used with mainstream applications, but also a lot of advantages for embedded world can be discussed.<\/p>\n<p>Here we will briefly take a look at few select features.<\/p>\n<h2>Concepts (C++ 20)<\/h2>\n<p>Concepts are very important features which come from the mathematics world. They can increase readability and reduce debug time drastically. Before concepts came around, if we wanted to make compile-time decisions based on type properties, we would use SFINAE (Substitution failure is not an error) principle and traits library. This was not a clean solution and wasn\u2019t easy to debug. But then concepts came around to address this problem. With concepts we can make compile-time decisions such as choosing which function overload based on tem- plate\u2019s properties, strictly describe the properties a template parameter should possess and so on. For example lets say we have a function called Adder which just takes two objects of the same type and returns the result of \u2018+\u2019 operator on them:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>template <typename  T>\nauto Caller(T&& first, T&& second)\n{\n    return first + second;\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Now this is simple enough but imagine you have function which does a lot more operations on the object. What happens if we pass an object that does not implement the \u2018+\u2019 operator? Well we get errors, but not a very readable one! and specially if our object needs to satisfy multiple properties, either we need to read the whole code to extract them or try adding one property at a time to get all of them for example. Now lets use concepts here:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>template<typename T>\nconcept Addable = requires (T&& t)\n{\n    t + t;\n};\ntemplate <typename  T>\nauto Caller(T&& first, T&& second) requires Addable<T>\n{\n    return first + second;\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Or even simpler<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>template <Addable T>\nauto Caller(T&& first, T&& second)\n{\n    return first + second;\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Basically what Addable is saying is that all of operations and lines of code performed with this type (for instance here just \u201ca + b\u201d) must be valid an compliable, otherwise, that&#8217;s an error. Now if the template type T is not addable compiler will give us a better error and using this mechanism we can avoid introducing undefined behavior and debug the code easier.<\/p>\n<h2>3-way comparisons (C++ 20)<\/h2>\n<p>3-way comparisons or otherwise known as spaceship operator, is a really neat new feature of C++ which can reduce significant amount of boilerplate code. It is used to guide the compiler on generating comparison operators automatically, thus reducing significantly the amount of redundant code the developer must implement. We implement only this operator (or even just use =default to ask the compiler to do it for us) and the compiler automatically generates all of six ==, !=, &lt;, &lt;=, &gt;, and &gt;= comparison operators! isn&#8217;t that just amazing? Lets take a look at how it works. In a basic sense this is how it simplifies the comparisons, The expression a &lt;=&gt; b returns an object such that:<\/p>\n<p>(a &lt;=&gt; b) &lt; 0 if a &lt; b<\/p>\n<p>(a &lt;=&gt; b) &gt; 0 if a &gt; b<\/p>\n<p>(a &lt;=&gt; b) == 0 if a and b are equal\/equivalent.<\/p>\n<p>Here\u2019s an example:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <compare>\n#include <iostream>\nint main()\n{\n    double foo = -0.0; \n    double bar = 0.0;\n    auto res = foo <=> bar;\n    if (res < 0)\n        std::cout << \"-0 is less than 0\";\n    else if (res > 0)\n        std::cout << \"-0 is greater than 0\";\n    else if (res == 0)\n        std::cout << \"-0 and 0 are equal\";\n    else\n        std::cout << \"-0 and 0 are unordered\";\n}<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>the output:<\/p>\n<p>-0 and 0 are equal<\/p>\n<h2>Constexpr relaxations (C++ 20)<\/h2>\n<p>C++ 20 compile time context is now Turing complete! What does that exactly mean? Well we were already able to some computations in compile time like:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>constexpr auto  Add(int a, int b)\n{\n    return a + b;\n}\n...\nconstexpr auto  result = add(10, 20);\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>The value of <strong>result <\/strong>will be calculated at compile time and inserted before the compilation. But what with C++ 20 is new is that we can now also call <strong>new <\/strong>and <strong>delete <\/strong>in compile time context but with one caveat. The compile time heap memory usage must not introduce memory problems and undefined behavior. Meaning if we allocate some variable with new and we dont delete it, we will get compilation error! How great is that?<\/p>\n<p>For example if we try to compile this code:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <iostream>\n#include <string>\nconstexpr  int Allocate()\n{\n    int * a = new int(10); \n    int b = *a;\n    delete  a;\n    return b;\n}\nint main()\n{\n    constexpr auto  res = Allocate();\n    return res;\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>this will compile without problem but watch what happens when we forget to delete the allocated memory:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <iostream>\n#include <string>\nconstexpr  int Allocate()\n{\n    int * a = new int(10); \n    int b = *a;\n    \/\/ delete a;\n    return b;\n}\nint main()\n{\n    constexpr auto  res = Allocate();\n    return res;\n}<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Compiler gives us:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp><source>: In function 'int main()':\n<source>:6:25: error: 'Allocate()' is not a constant expression because allocated storage h\n    6 |     int * a = new int(10);\n      |\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>This way we can even test our code for memory leaks and other problems at compile time and get a compiler error instead of runtime error and we can guarantee the code is memory safe. This is really huge.<\/p>\n<h2>source_location (C++ 20)<\/h2>\n<p>source_location is an awesome tool added to C++ 20 and can be used to query some information about te source code like the file name, file line, etc. It is specially beneficial in logging and debugging. Here\u2019s an eample of how we can use it:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <iostream>\n#include <source_location>\nint main() {\n    const auto sl = std::source_location::current();\n    std::cout << sl.file_name() << \"(\"\n              << sl.line() << \":\"\n              << sl.column() << \") \"\n              << sl.function_name() << std::endl;\n    return 0;\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>The output would be for example:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>example.cpp(28:50) int main()\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Or in a more practical sense we can do:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <iostream>\n#include <source_location>\nvoid log(std::string const& message, const std::source_location sl = std::source_location::\n{\n    std::cout << sl.file_name() << \"(\"\n              << sl.line() << \":\"\n              << sl.column() << \") \"\n              << sl.function_name() << \" : \"\n              << message << 'n';\n}\nint main() {\n    Log(\"Hello world\");\n    return 0;\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Which would output something like:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>example.cpp(25:8) int main() : Hello world\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Notice one very important thing here that function parameters are constructed on the caller function\u2019s stack therefore source_location object will actually con- tain the source_location data about the caller function which is actually a genius idea and can be useful to many logging libraries<\/p>\n<h2>Format (C++ 20 and 23)<\/h2>\n<p>In C++ 20 some mechanisms similar to fmt library was added to standard library. lib fmt is a very popular and loved library for string formatting and printing which is a very good and easy to use substitute for using std::cout. Unfortunately not all of the features are adopted. Here is an example:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <format> \n#include <iostream> \n#include <string> \n#include <string_view>\nint main() {\n    std::cout << std::format(\"Hello {}!n\", \"world\");\n    std::string fmt;\n    for (int i{}; i != 3; ++i) {\n        fmt += \"{} \"; \/\/ constructs  the  formatting  string\n        std::cout << fmt << \" : \";\n        std::cout << dyna_print(fmt, \"alpha\", 'Z', 3.14, \"unused\"); \n        std::cout << 'n';\n    }\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>The good news is that in C++ 23 more lib fmt like features are adopted for example <strong>std::print <\/strong>and even an extra <strong>std::println <\/strong>is added.<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <cstdio> \n#include <filesystem> \n#include <print>\nint main()\n{\n    std::print(\"{0} {2}{1}!n\", \"Hello\", 23, \"C++\"); \/\/ overload  (1)\n    const auto tmp {std::filesystem::temp_directory_path() \/ \"test.txt\"};\n    if (std::FILE* stream {std::fopen(tmp.c_str(),     \"w\")})\n    {\n        std::print(stream, \"File: {}\", tmp.string()); \/\/ overload  (2)\n        std::fclose(stream);\n    }\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<h2>Modules (C++ 20)<\/h2>\n<p>C++ 20 introduced modules. Modules are translation units which will pro- vide functionalities for other parts of the code. They can be an alternative to header\/source includes.<\/p>\n<p>here\u2019s an example of exporting a module:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>export  module  helloworld; \/\/  module  declaration\nimport  <iostream>;\t\/\/  import  declaration\nexport void hello()\t\/\/  export  declaration\n{\n    std::cout << \"Hello world!n\";\n}\nexport\n{\n    int one() { return 1; } \n    int zero() { return 0; }\n}\n\/\/ Exporting  namespaces  also  works:  hi::english()  and  hi::french()  will  be  visible.\nexport namespace  hi\n{\n    char const* english() { return \"Hi!\"; } \n    char const* french() { return \"Salut!\"; }\n}<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>and like this we can use it:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>\nimport helloworld; \/\/  import  declaration\nint main()\n{\n    hello();\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<h2>Consteval if (C++ 23)<\/h2>\n<p>Executing in compile time is awesome but only if there was a way to know if a function is executing in compile time or runtime so that we could for example choose a more compile-time friendly algorithm if needed. Well good news is that there is now! with <strong>consteval if <\/strong>we can make decisions based on the execution context and execute different strategies for compile time and runtime execution. Here\u2019s an example:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>constexpr int fibonacci(int n)\n{\n    if consteval\n    {\n        \/\/ choose  a  compile  time  friendly  algorithm\n    }\n    else\n    {\n        \/\/ choose  another  algorithm\n    }\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<h2>Multi-dimension array subscript operator (C++ 23)<\/h2>\n<p>Finally the moment we\u2019ve been waiting for. We can finally have multi-dimension array subscript operators. Here\u2019s an example:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <array>\n#include <cassert>\n#include <iostream>\ntemplate <typename T, std::size_t Z, std::size_t Y, std::size_t X>\nstruct Array3d\n{\n    std::array<T, X * Y * Z> m{};\n    constexpr T& operator[](std::size_t z, std::size_t y, std::size_t x) \/\/ C++23\n    {\n        assert(x < X and y < Y and z < Z);\n        return m[z * Y * X + y * X + x];\n    }\n};\nint main()\n{\n    Array3d<int, 4, 3, 2> v;\n    v[3, 2, 1] = 42;\n    std::cout << \"v[3, 2, 1] = \" << v[3, 2, 1] << 'n';\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<h2>Deducing this (C++ 23)<\/h2>\n<p>In a lot of other languages, it is possible to explicitly access the current object through the parameter list of a member function. It is also now possible in C++. <strong>A non-static member function can be declared to take as its first parameter an explicit object parameter, denoted with the prefixed keyword this.<\/strong><\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>struct X\n{\n    void foo(this X const& self, int i); \/\/ same as void foo(int i) const &;\n\/\/\tvoid foo(int i) const &; \/\/ Error: already declared\n    void bar(this X self, int i); \/\/ pass object by value: makes a copy of `*this`\n};\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>By taking advantage of this new feature we can do a technique called <strong>deducing <\/strong><strong>this <\/strong>like bellow:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>struct X\n{\n    template<typename   Self> void foo(this Self&&, int);\n};\nstruct D : X {};\nvoid ex(X& x, D& d)\n{\n    x.foo(1);\t\/\/ Self = X& \n    move(x).foo(2); \/\/ Self = X \n    d.foo(3);\t\/\/ Self = D&\n}<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Its specific benefit is that it will help us reduce boilerplate code specially when writing the same member functions for const and non-const instances of the object.<\/p>\n<h2>Stacktrace (C++ 23)<\/h2>\n<p>Although this feature is still very immature and not yet fully supported, but it is possible to use it with the trunk version of gcc and when linking against <u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/u>-lstdc++_libbacktrace<u>&nbsp;&nbsp;&nbsp; &nbsp;<\/u>library. There is not yet much information about it and it is very much possible to change but the straight forward usage is something like:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <stacktrace> \n#include <string> \n#include <iostream>\nint main()\n{\n    std::cout << std::to_string(std::stacktrace::current()) << std::endl;\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<h2>Ranges and Views (C++ 20 and 23)<\/h2>\n<p>A new interesting library is added in C++ 20 called ranges. The library cre- ates and manipulates range views, lightweight objects that indirectly represent iterable sequences (ranges). Ranges are an abstraction on top of it. with this library we can now do very interesting things. we can also use | (pipe operator) and they can be combined as well. Take this example:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <iomanip> \n#include <iostream> \n#include <ranges> \n#include <vector> \n#include <string_view>\nint main()\n{\n    std::vector vec{1, 2, 3, 4, 5, 6};\n    auto v = vec | std::views::reverse | std::views::drop(2);\n    std::cout << *v.begin() << 'n';\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Will print:<br \/>\n4<br \/>\nOr another example:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>#include <iomanip> \n#include <iostream> \n#include <ranges> \n#include <string_view>\nint main()\n{\n    constexpr std::string_view words{\"Hello^_^C++^_^20^_^!\"};\n    constexpr std::string_view delim{\"^_^\"};\n    for (const auto  word : std::views::split(words, delim))\n        std::cout << std::quoted(std::string_view{word.begin(), word.end()}) << ' ';\n}\n<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<p>Will print:<\/p>\n<pre data-line=\"\">\t\t\t\t<code readonly=\"true\">\n\t\t\t\t\t<xmp>\"Hello\" \"C++\" \"20\" \"!\"<\/xmp>\n\t\t\t\t<\/code>\n<\/pre>\n<h2>Schlussfolgerung<\/h2>\n<p>There are many new C++ feature from which I only could mention the very select one. These new features are there to help the developers reduce their workload and the amount of boilerplate code they require to write. Some of these features like constexpr context can also be used to do infinite things and really clever compile time optimizations specially for embedded devices with limited memory and processing power.<\/p>","protected":false},"excerpt":{"rendered":"<p>C++ 20 and 23 have a lot of new features which can reduce boilerplate code, increase e\ufb00iciency and make the code drastically more readable. Not only they can be used with mainstream applications, but also a lot of advantages for embedded world can be discussed. Here we will briefly take a look at few select&hellip;&nbsp;<a href=\"https:\/\/digitalgateamg.com\/de\/blog\/2023\/03\/01\/important-new-c-features\/\" class=\"\" rel=\"bookmark\">Weiterlesen &raquo;<span class=\"screen-reader-text\">Important New C++ Features<\/span><\/a><\/p>","protected":false},"author":12,"featured_media":13269,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"coauthors":[],"class_list":["post-13249","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.1 (Yoast SEO v26.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Important New C++ Features - DigitalGate Custom Electronics<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/digitalgateamg.com\/de\/blog\/2023\/03\/01\/important-new-c-features\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Important New C++ Features\" \/>\n<meta property=\"og:description\" content=\"C++ 20 and 23 have a lot of new features which can reduce boilerplate code, increase e\ufb00iciency and make the code drastically more readable. Not only they can be used with mainstream applications, but also a lot of advantages for embedded world can be discussed. Here we will briefly take a look at few select&hellip;&nbsp;Weiterlesen &raquo;Important New C++ Features\" \/>\n<meta property=\"og:url\" content=\"https:\/\/digitalgateamg.com\/de\/blog\/2023\/03\/01\/important-new-c-features\/\" \/>\n<meta property=\"og:site_name\" content=\"DigitalGate Custom Electronics\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DigitalGateamg\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-01T15:20:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-08T14:43:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png\" \/>\n\t<meta property=\"og:image:width\" content=\"928\" \/>\n\t<meta property=\"og:image:height\" content=\"627\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Digital Gate\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Digital Gate\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"13\u00a0Minuten\" \/>\n\t<meta name=\"twitter:label3\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data3\" content=\"Digital Gate\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/\"},\"author\":{\"name\":\"Digital Gate\",\"@id\":\"https:\/\/digitalgateamg.com\/#\/schema\/person\/27511cb01dbba51abd9b489e6adc2fce\"},\"headline\":\"Important New C++ Features\",\"datePublished\":\"2023-03-01T15:20:34+00:00\",\"dateModified\":\"2023-08-08T14:43:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/\"},\"wordCount\":1323,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/digitalgateamg.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png\",\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/\",\"url\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/\",\"name\":\"Important New C++ Features - DigitalGate Custom Electronics\",\"isPartOf\":{\"@id\":\"https:\/\/digitalgateamg.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png\",\"datePublished\":\"2023-03-01T15:20:34+00:00\",\"dateModified\":\"2023-08-08T14:43:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#primaryimage\",\"url\":\"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png\",\"contentUrl\":\"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png\",\"width\":928,\"height\":627},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/digitalgateamg.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Important New C++ Features\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/digitalgateamg.com\/#website\",\"url\":\"https:\/\/digitalgateamg.com\/\",\"name\":\"DigitalGate Custom Electronics\",\"description\":\"Embedded Software and Hardware Solutions\",\"publisher\":{\"@id\":\"https:\/\/digitalgateamg.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/digitalgateamg.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/digitalgateamg.com\/#organization\",\"name\":\"DigitalGate Amg S.A.\",\"url\":\"https:\/\/digitalgateamg.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/digitalgateamg.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2021\/10\/logo-firma.png\",\"contentUrl\":\"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2021\/10\/logo-firma.png\",\"width\":370,\"height\":370,\"caption\":\"DigitalGate Amg S.A.\"},\"image\":{\"@id\":\"https:\/\/digitalgateamg.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/DigitalGateamg\/\",\"https:\/\/www.linkedin.com\/company\/sc-digitalgate-amg-srl\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/digitalgateamg.com\/#\/schema\/person\/27511cb01dbba51abd9b489e6adc2fce\",\"name\":\"Digital Gate\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/digitalgateamg.com\/#\/schema\/person\/image\/cf8ad43aefc829ce3a5afa607f56c6f6\",\"url\":\"https:\/\/digitalgateamg.com\/wp-content\/litespeed\/avatar\/46f85298923a63b5939c9a06d38c2790.jpg?ver=1776247194\",\"contentUrl\":\"https:\/\/digitalgateamg.com\/wp-content\/litespeed\/avatar\/46f85298923a63b5939c9a06d38c2790.jpg?ver=1776247194\",\"caption\":\"Digital Gate\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Important New C++ Features - DigitalGate Custom Electronics","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/digitalgateamg.com\/de\/blog\/2023\/03\/01\/important-new-c-features\/","og_locale":"de_DE","og_type":"article","og_title":"Important New C++ Features","og_description":"C++ 20 and 23 have a lot of new features which can reduce boilerplate code, increase e\ufb00iciency and make the code drastically more readable. Not only they can be used with mainstream applications, but also a lot of advantages for embedded world can be discussed. Here we will briefly take a look at few select&hellip;&nbsp;Weiterlesen &raquo;Important New C++ Features","og_url":"https:\/\/digitalgateamg.com\/de\/blog\/2023\/03\/01\/important-new-c-features\/","og_site_name":"DigitalGate Custom Electronics","article_publisher":"https:\/\/www.facebook.com\/DigitalGateamg\/","article_published_time":"2023-03-01T15:20:34+00:00","article_modified_time":"2023-08-08T14:43:03+00:00","og_image":[{"width":928,"height":627,"url":"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png","type":"image\/png"}],"author":"Digital Gate","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Digital Gate","Gesch\u00e4tzte Lesezeit":"13\u00a0Minuten","Written by":"Digital Gate"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#article","isPartOf":{"@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/"},"author":{"name":"Digital Gate","@id":"https:\/\/digitalgateamg.com\/#\/schema\/person\/27511cb01dbba51abd9b489e6adc2fce"},"headline":"Important New C++ Features","datePublished":"2023-03-01T15:20:34+00:00","dateModified":"2023-08-08T14:43:03+00:00","mainEntityOfPage":{"@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/"},"wordCount":1323,"commentCount":0,"publisher":{"@id":"https:\/\/digitalgateamg.com\/#organization"},"image":{"@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#primaryimage"},"thumbnailUrl":"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png","articleSection":["Uncategorized"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/","url":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/","name":"Important New C++ Features - DigitalGate Custom Electronics","isPartOf":{"@id":"https:\/\/digitalgateamg.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#primaryimage"},"image":{"@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#primaryimage"},"thumbnailUrl":"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png","datePublished":"2023-03-01T15:20:34+00:00","dateModified":"2023-08-08T14:43:03+00:00","breadcrumb":{"@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#primaryimage","url":"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png","contentUrl":"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png","width":928,"height":627},{"@type":"BreadcrumbList","@id":"https:\/\/digitalgateamg.com\/blog\/2023\/03\/01\/important-new-c-features\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/digitalgateamg.com\/"},{"@type":"ListItem","position":2,"name":"Important New C++ Features"}]},{"@type":"WebSite","@id":"https:\/\/digitalgateamg.com\/#website","url":"https:\/\/digitalgateamg.com\/","name":"DigitalGate Custom Electronics","description":"Embedded Software and Hardware Solutions","publisher":{"@id":"https:\/\/digitalgateamg.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/digitalgateamg.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/digitalgateamg.com\/#organization","name":"DigitalGate Amg S.A.","url":"https:\/\/digitalgateamg.com\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/digitalgateamg.com\/#\/schema\/logo\/image\/","url":"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2021\/10\/logo-firma.png","contentUrl":"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2021\/10\/logo-firma.png","width":370,"height":370,"caption":"DigitalGate Amg S.A."},"image":{"@id":"https:\/\/digitalgateamg.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DigitalGateamg\/","https:\/\/www.linkedin.com\/company\/sc-digitalgate-amg-srl\/"]},{"@type":"Person","@id":"https:\/\/digitalgateamg.com\/#\/schema\/person\/27511cb01dbba51abd9b489e6adc2fce","name":"Digital Gate","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/digitalgateamg.com\/#\/schema\/person\/image\/cf8ad43aefc829ce3a5afa607f56c6f6","url":"https:\/\/digitalgateamg.com\/wp-content\/litespeed\/avatar\/46f85298923a63b5939c9a06d38c2790.jpg?ver=1776247194","contentUrl":"https:\/\/digitalgateamg.com\/wp-content\/litespeed\/avatar\/46f85298923a63b5939c9a06d38c2790.jpg?ver=1776247194","caption":"Digital Gate"}}]}},"jetpack_featured_media_url":"https:\/\/digitalgateamg.com\/wp-content\/uploads\/2023\/03\/important-new-C-features.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/posts\/13249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/comments?post=13249"}],"version-history":[{"count":0,"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/posts\/13249\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/media\/13269"}],"wp:attachment":[{"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/media?parent=13249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/categories?post=13249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/tags?post=13249"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digitalgateamg.com\/de\/wp-json\/wp\/v2\/coauthors?post=13249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}