{"id":3551,"date":"2019-09-12T08:24:54","date_gmt":"2019-09-12T06:24:54","guid":{"rendered":"https:\/\/mariusbancila.ro\/blog\/?p=3551"},"modified":"2019-09-12T08:24:54","modified_gmt":"2019-09-12T06:24:54","slug":"cpp20-concepts-in-visual-studio-2019-16-3-preview-2","status":"publish","type":"post","link":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/","title":{"rendered":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2"},"content":{"rendered":"<p>Back in mid-August, Microsoft released the <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-2019-version-16-3-preview-2-and-visual-studio-for-mac-version-8-3-preview-2-released\/\" rel=\"noopener noreferrer\" target=\"_blank\">2nd preview of Visual Studio 2019 16.3<\/a>. This is the first version of Visual Studio to <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/c20-concepts-are-here-in-visual-studio-2019-version-16-3\/\" rel=\"noopener noreferrer\" target=\"_blank\">support concepts from C++20<\/a> both in the compiler and the standard library (header <tt>&lt;concepts&gt;<\/tt>) without the changes made at the ISO C++ standards meeting in Cologne. These changes are available when you compile with the <tt>\/std:c++latest<\/tt> switch.<\/p>\n<p>Concepts allow performing compile-time validation of template arguments and function dispatch based on properties of types. Concepts are very useful in libraries where they can be used to impose compile-time checks on the template arguments of functions or types. For instance, a generic algorithm for sorting a container would require the container type to be sortable for the program to even compile.<\/p>\n<p>In this article, I will show an example with a concept that verifies that a type <tt>T<\/tt> can be converted to a <tt>std::string<\/tt> via a <tt>to_string()<\/tt> function, that is either a member of the class or a free function.<\/p>\n<p><!-- more --><\/p>\n<p>In the code below, <tt>OverloadsToString<\/tt> is a concept that checks that a free function called <tt>to_string<\/tt> exists, and it takes a single argument of type <tt>T<\/tt> and returns a <tt>std::string<\/tt>. On the other hand, <tt>HasToString<\/tt> is a concept that checks that a type <tt>T<\/tt> has a method called <tt>to_string<\/tt> that takes no arguments and returns a <tt>std::string<\/tt>. These two concepts, are composed together using operator <tt>||<\/tt> in a new concept called  <tt>StringConvertible<\/tt>. A concept composed this way is called a <em>disjuction<\/em>. On the other hand, a composition of two constraints with operator <tt>&amp;&amp;<\/tt> is called a <em>conjunction<\/em>.<\/p>\n<pre class=\"lang:c++ decode:true \" >#include &lt;string&gt;\r\n#include &lt;concepts&gt;\r\n\r\ntemplate &lt;typename T&gt;\r\nconcept OverloadsToString = requires (T v)\r\n{\r\n\t{to_string(v)}-&gt;std::string;\r\n};\r\n\r\ntemplate &lt;typename T&gt;\r\nconcept HasToString = requires (T v)\r\n{\r\n\t{v.to_string()}-&gt;std::string;\r\n};\r\n\r\ntemplate &lt;typename T&gt;\r\nconcept StringConvertible = OverloadsToString&lt;T&gt; || \r\n                            HasToString&lt;T&gt;;\r\n<\/pre>\n<p>We can use the <tt>StringConvertible<\/tt> concepts to perform checks on types. In the following example, an instance of the class <tt>foo<\/tt> can be converted to a <tt>std::string<\/tt> using the function <tt>to_string<\/tt> (for simplicity, this function does not to much except returning the same string for all instances). For the class <tt>bar<\/tt> there is no way to convert an instance of it to a <tt>std::string<\/tt>. On the other hand, the class <tt>foobar<\/tt> has a method called <tt>to_string<\/tt>. We can verify that a type is satifsfying the concept or not using <tt>static_assert<\/tt>, as shown below:<\/p>\n<pre class=\"lang:c++ decode:true \" >\r\nstruct foo {};\r\nstruct bar {};\r\nstruct foobar\r\n{\r\n\tstd::string to_string() { return \"foobar\"; }\r\n};\r\n\r\nstd::string to_string(foo const&amp; f)\r\n{\r\n\treturn \"foo\";\r\n}\r\n\r\nstatic_assert(StringConvertible&lt;foo&gt;);\r\nstatic_assert(!StringConvertible&lt;bar&gt;);\r\nstatic_assert(StringConvertible&lt;foobar&gt;);\r\n<\/pre>\n<p>As mentioned earlier, concepts are useful to express expectations on the template arguments of a function template or a class template. In the following example, <tt>serialize<\/tt> is a function template that expects its template argument to be convertible to a <tt>std::string<\/tt>. Similarly, <tt>Serializable<\/tt> is a class template that expects the template argument <tt>T<\/tt> to be convertible to a <tt>std::string<\/tt>.<\/p>\n<pre class=\"lang:c++ decode:true \" >template &lt;typename T&gt; requires StringConvertible&lt;T&gt;\r\nvoid serialize(T const &amp; value)\r\n{\t\r\n}\r\n\r\ntemplate &lt;typename T&gt; requires StringConvertible&lt;T&gt;\r\nstruct Serializable\r\n{\r\n\tT value;\r\n};\r\n\r\nint main()\r\n{\r\n\tserialize(foo{});\r\n\tserialize(bar{});         \/\/ error: the associated constraints are not satisfied\r\n\tserialize(foobar{});\r\n\r\n\tSerializable&lt;foo&gt; f;\r\n\tSerializable&lt;bar&gt; b;      \/\/ error: the associated constraints are not satisfied\r\n\tSerializable&lt;foobar&gt; fb;\r\n}<\/pre>\n<p>If you compile this code, the lines marked with error (in the comments) will produce the following errors:<\/p>\n<pre class=\"lang:default decode:true \" >\r\nconcepts_test.cpp(50,2) : error C2672: 'serialize': no matching overloaded function found\r\nconcepts_test.cpp(50,17) : error C7602: 'serialize': the associated constraints are not satisfied\r\nconcepts_test.cpp(37) : message : see declaration of 'serialize'\r\n\r\nconcepts_test.cpp(54,18) : error C7602: 'Serializable': the associated constraints are not satisfied\r\nconcepts_test.cpp(43) : message : see declaration of 'Serializable'\r\nconcepts_test.cpp(54,20) : error C7602: 'Serializable': the associated constraints are not satisfied\r\nconcepts_test.cpp(43) : message : see declaration of 'Serializable'\r\nconcepts_test.cpp(54) : error C2641: cannot deduce template arguments for 'Serializable'\r\nconcepts_test.cpp(54,21) : error C2783: 'Serializable&lt;T&gt; Serializable(void)': could not deduce template argument for 'T'\r\nconcepts_test.cpp(43) : message : see declaration of 'Serializable'\r\nconcepts_test.cpp(54,20) : error C2512: 'Serializable': no appropriate default constructor available\r\nconcepts_test.cpp(43,1) : message : see declaration of 'Serializable'<\/pre>\n<p>The syntax used above (<tt>template &lt;typename T&gt; requires StringConvertible&lt;T&gt;<\/tt>) to specify the expectations on the template argument is a bit cumbersome. An alternative that is simpler and more intuitive exists:<\/p>\n<pre class=\"lang:c++ decode:true \" >template &lt;StringConvertible T&gt;\r\nvoid serialize(T const&amp; value)\r\n{\r\n}\r\n\r\ntemplate &lt;StringConvertible T&gt;\r\nstruct Serializable\r\n{\r\n\tT value;\r\n};<\/pre>\n<p>All the code shown here compiles with Visual Studio 2019 16.3 Preview 2.<\/p>\n<p>Of course, this is barely an introduction to concepts. There are many more things you need to learn about concepts, which you can find on thw web. You can learn more about concepts here:<\/p>\n<ul>\n<li><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/constraints\" target=\"_blank\" rel=\"noopener noreferrer\">Constraints and concepts<\/a><\/li>\n<li><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/concepts\" target=\"_blank\" rel=\"noopener noreferrer\">Concepts library<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Back in mid-August, Microsoft released the <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-2019-version-16-3-preview-2-and-visual-studio-for-mac-version-8-3-preview-2-released\/\" rel=\"noopener noreferrer\" target=\"_blank\">2nd preview of Visual Studio 2019 16.3<\/a>. This is the first version of Visual Studio to <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/c20-concepts-are-here-in-visual-studio-2019-version-16-3\/\" rel=\"noopener noreferrer\" target=\"_blank\">support concepts from C++20<\/a> both in the compiler and the standard library (header <tt>&lt;concepts&gt;<\/tt>) without the changes made at the ISO C++ standards meeting in Cologne. These changes are available when you compile with the <tt>\/std:c++latest<\/tt> switch.<\/p>\n<p>Concepts allow performing compile-time validation of template arguments and function dispatch based on properties of types. Concepts are very useful in libraries where they can be used to impose compile-time checks on the template arguments of functions or types. For instance, a generic algorithm for sorting a container would require the container type to be sortable for the program to even compile.<\/p>\n<p>In this article, I will show an example with a concept that verifies that a type <tt>T<\/tt> can be converted to a <tt>std::string<\/tt> via a <tt>to_string()<\/tt> function, that is either a member of the class or a free function.<\/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,543,153,55,577],"class_list":["post-3551","post","type-post","status-publish","format-standard","hentry","category-c","tag-c","tag-c20","tag-concepts","tag-visualstudio","tag-vs2019"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them.\" \/>\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++20,concepts,visualstudio,vs2019\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\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=\"C++20 Concepts in Visual Studio 2019 16.3 Preview 2\" \/>\n\t\t<meta property=\"og:description\" content=\"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-09-12T06:24:54+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-09-12T06:24:54+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"C++20 Concepts in Visual Studio 2019 16.3 Preview 2\" \/>\n\t\t<meta name=\"twitter:description\" content=\"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them.\" \/>\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\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\\\/#article\",\"name\":\"C++20 Concepts in Visual Studio 2019 16.3 Preview 2\",\"headline\":\"C++20 Concepts in Visual Studio 2019 16.3 Preview 2\",\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"},\"datePublished\":\"2019-09-12T08:24:54+02:00\",\"dateModified\":\"2019-09-12T08:24:54+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\\\/#webpage\"},\"articleSection\":\"C++, C++, c++20, concepts, VisualStudio, VS2019\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-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\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\\\/#listItem\",\"name\":\"C++20 Concepts in Visual Studio 2019 16.3 Preview 2\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\\\/#listItem\",\"position\":5,\"name\":\"C++20 Concepts in Visual Studio 2019 16.3 Preview 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\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-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\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\\\/#webpage\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\\\/\",\"name\":\"C++20 Concepts in Visual Studio 2019 16.3 Preview 2\",\"description\":\"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2019\\\/09\\\/12\\\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2019-09-12T08:24:54+02:00\",\"dateModified\":\"2019-09-12T08:24:54+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":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2","description":"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them.","canonical_url":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/","robots":"max-image-preview:large","keywords":"c++,c++20,concepts,visualstudio,vs2019","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/#article","name":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2","headline":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2","author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"},"datePublished":"2019-09-12T08:24:54+02:00","dateModified":"2019-09-12T08:24:54+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/#webpage"},"isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/#webpage"},"articleSection":"C++, C++, c++20, concepts, VisualStudio, VS2019"},{"@type":"BreadcrumbList","@id":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-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\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/#listItem","name":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/#listItem","position":5,"name":"C++20 Concepts in Visual Studio 2019 16.3 Preview 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\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-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\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/#webpage","url":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/","name":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2","description":"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/#breadcrumblist"},"author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"datePublished":"2019-09-12T08:24:54+02:00","dateModified":"2019-09-12T08:24:54+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":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2","og:description":"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them.","og:url":"https:\/\/mariusbancila.ro\/blog\/2019\/09\/12\/cpp20-concepts-in-visual-studio-2019-16-3-preview-2\/","article:published_time":"2019-09-12T06:24:54+00:00","article:modified_time":"2019-09-12T06:24:54+00:00","twitter:card":"summary","twitter:title":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2","twitter:description":"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them."},"aioseo_meta_data":{"post_id":"3551","title":"C++20 Concepts in Visual Studio 2019 16.3 Preview 2","description":"C++20 Concepts are now available in Visual Studio 2019 16.3 Preview 2. In this article, we take a look at some concepts examples, how to write and use them.","keywords":[{"label":"C++","value":"C++"},{"label":"C++20","value":"C++20"},{"label":"concepts","value":"concepts"},{"label":"VisualStudio","value":"VisualStudio"},{"label":"VS2019","value":"VS2019"}],"keyphrases":null,"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":null,"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":"","isEnabled":true},"graphs":[]},"schema_type":null,"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":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-18 21:03:35","updated":"2025-12-12 07:53:21","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":"Back in mid-August, Microsoft released the 2nd preview of Visual Studio 2019 16.3. This is the first version of Visual Studio to support concepts from C++20 both in the compiler and the standard library (header &lt;concepts&gt;) without the changes made at the ISO C++ standards meeting in Cologne. These changes are available when you compile&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++20<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">concepts<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">VisualStudio<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">VS2019<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">C++<\/span>","<span class=\"advgb-post-tax-term\">c++20<\/span>","<span class=\"advgb-post-tax-term\">concepts<\/span>","<span class=\"advgb-post-tax-term\">VisualStudio<\/span>","<span class=\"advgb-post-tax-term\">VS2019<\/span>"]}},"comment_count":"0","relative_dates":{"created":"Posted 7 years ago","modified":"Updated 7 years ago"},"absolute_dates":{"created":"Posted on September 12, 2019","modified":"Updated on September 12, 2019"},"absolute_dates_time":{"created":"Posted on September 12, 2019 8:24 am","modified":"Updated on September 12, 2019 8:24 am"},"featured_img_caption":"","series_order":"","jetpack_shortlink":"https:\/\/wp.me\/pYNdv-Vh","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/3551","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=3551"}],"version-history":[{"count":12,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/3551\/revisions"}],"predecessor-version":[{"id":3563,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/3551\/revisions\/3563"}],"wp:attachment":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/media?parent=3551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/categories?post=3551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/tags?post=3551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}