{"id":2968,"date":"2018-05-23T21:00:05","date_gmt":"2018-05-23T19:00:05","guid":{"rendered":"https:\/\/mariusbancila.ro\/blog\/?p=2968"},"modified":"2018-05-24T13:02:58","modified_gmt":"2018-05-24T11:02:58","slug":"template-auto","status":"publish","type":"post","link":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/","title":{"rendered":"template &lt;auto&gt;"},"content":{"rendered":"<p>If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as <tt>template &lt;auto&gt;<\/tt> helps simplify these scenarios.<\/p>\n<p>Let&#8217;s take as an example the declaration of a constant template.<\/p>\n<pre class=\"lang:c++ decode:true \" >template &lt;typename T, T value&gt; \r\nconstexpr T numeric_constant = value;\r\n\r\nconstexpr auto const the_answer = numeric_constant&lt;int, 42&gt;;<\/pre>\n<p>In C++17, this can be simplified as follows:<\/p>\n<pre class=\"lang:c++ decode:true \" >template &lt;auto value&gt; \r\nconstexpr auto numeric_constant = value;\r\n\r\nconstexpr auto const the_answer = numeric_constant&lt;42&gt;;<\/pre>\n<p>You no longer need to specify the type for non-type template parameters, it is automatically deduced by the compiler. Here is another example:<\/p>\n<pre class=\"lang:c++ decode:true \" >template &lt;auto value&gt; \r\nvoid foo() { \/*... *\/ }\r\n\r\nfoo&lt;42&gt;();      \/\/ deduces int\r\nfoo&lt;false&gt;();   \/\/ deduces bool\r\n<\/pre>\n<p>Let&#8217;s look at an example where <tt>template &lt;auto&gt;<\/tt> can simplify the code. The standard defines a type called <tt>std::integral_constant<\/tt> that wraps a static constant of a specified type and is the base class for the C++ type traits. <tt>std::true_type<\/tt> and <tt>std::false_type<\/tt> are two of those. These could be implemented as follows:<\/p>\n<pre class=\"lang:c++ decode:true \" >\r\ntemplate&lt;class T, T val&gt;\r\nstruct integral_constant\r\n{\r\n   static constexpr T value = val;\r\n\r\n   using value_type = T;\r\n   using type = integral_constant;\r\n\r\n   constexpr operator value_type() const noexcept { return value; }\r\n\r\n   [[nodiscard]] constexpr value_type operator()() const noexcept { return value; }\r\n};\r\n\r\ntemplate&lt;bool val&gt;\r\nusing bool_constant = integral_constant&lt;bool, val&gt;;\r\n\r\nusing true_type = bool_constant&lt;true&gt;;\r\nusing false_type = bool_constant&lt;false&gt;;<\/pre>\n<p>With <tt>template &lt;auto&gt;<\/tt> this code can be written as following:<\/p>\n<pre class=\"lang:c++ decode:true \" >\r\ntemplate&lt;auto val&gt;\r\nstruct integral_constant\r\n{\r\n   static constexpr auto value = val;\r\n\r\n   using value_type = decltype(val);\r\n   using type = integral_constant;\r\n\r\n   constexpr operator value_type() const noexcept { return value; }\r\n\r\n   [[nodiscard]] constexpr value_type operator()() const noexcept { return value; }\r\n};\r\n\r\nusing true_type = integral_constant&lt;true&gt;;\r\nusing false_type = integral_constant&lt;false&gt;;<\/pre>\n<p><strong>Note<\/strong>: Although this works fine with Clang and GCC, VC++ 15.7 complains about the use of <tt>decltype(val)<\/tt>.<\/p>\n<p><strong>Note<\/strong>: It may be more cumbersome to deduce some types. For instance, if you need a <tt>short<\/tt> type, there is no way to specify a <tt>short<\/tt> literal. You must indicate that with a cast. In order words, if you want a <tt>short<\/tt> 42 integral constant, you need to declare it like this:<\/p>\n<pre class=\"lang:c++ decode:true \" >using short_42 = integral_constant&lt;(short)42&gt;;<\/pre>\n<p>This feature is also useful with variadic templates for creating compile-time lists of henerogenous values. Here is an example:<\/p>\n<pre class=\"lang:c++ decode:true \" >template &lt;auto ... vs&gt;\r\nstruct heterogenous_list {};\r\n\r\nusing ultimate_list = heterogenous_list&lt;42, \"the ultimate answer\", true&gt;;<\/pre>\n<p>For more information on this topic, see <a href=\"http:\/\/open-std.org\/JTC1\/SC22\/WG21\/docs\/papers\/2016\/p0127r1.html\" rel=\"noopener\" target=\"_blank\">Declaring non-type template arguments with auto<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as <tt>template &lt;auto&gt;<\/tt> helps simplify these scenarios.<\/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":[75,451,323,560],"class_list":["post-2968","post","type-post","status-publish","format-standard","hentry","category-c","tag-auto","tag-c","tag-templates","tag-typetraits"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template helps simplify these scenarios.\" \/>\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++,templates,auto,typetraits\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/\" \/>\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=\"template\" \/>\n\t\t<meta property=\"og:description\" content=\"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template helps simplify these scenarios.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2018-05-23T19:00:05+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2018-05-24T11:02:58+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"template\" \/>\n\t\t<meta name=\"twitter:description\" content=\"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template helps simplify these scenarios.\" \/>\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\\\/2018\\\/05\\\/23\\\/template-auto\\\/#article\",\"name\":\"template\",\"headline\":\"template &lt;auto&gt;\",\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"},\"datePublished\":\"2018-05-23T21:00:05+02:00\",\"dateModified\":\"2018-05-24T13:02:58+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":3,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/05\\\/23\\\/template-auto\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/05\\\/23\\\/template-auto\\\/#webpage\"},\"articleSection\":\"C++, auto, C++, templates, typetraits\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/05\\\/23\\\/template-auto\\\/#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\\\/2018\\\/05\\\/23\\\/template-auto\\\/#listItem\",\"name\":\"template &lt;auto&gt;\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/05\\\/23\\\/template-auto\\\/#listItem\",\"position\":5,\"name\":\"template &lt;auto&gt;\",\"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\\\/2018\\\/05\\\/23\\\/template-auto\\\/#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\\\/2018\\\/05\\\/23\\\/template-auto\\\/#webpage\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/05\\\/23\\\/template-auto\\\/\",\"name\":\"template\",\"description\":\"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template helps simplify these scenarios.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2018\\\/05\\\/23\\\/template-auto\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2018-05-23T21:00:05+02:00\",\"dateModified\":\"2018-05-24T13:02:58+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":"template","description":"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template helps simplify these scenarios.","canonical_url":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/","robots":"max-image-preview:large","keywords":"c++,templates,auto,typetraits","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/#article","name":"template","headline":"template &lt;auto&gt;","author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"},"datePublished":"2018-05-23T21:00:05+02:00","dateModified":"2018-05-24T13:02:58+02:00","inLanguage":"en-US","commentCount":3,"mainEntityOfPage":{"@id":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/#webpage"},"isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/#webpage"},"articleSection":"C++, auto, C++, templates, typetraits"},{"@type":"BreadcrumbList","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/#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\/2018\/05\/23\/template-auto\/#listItem","name":"template &lt;auto&gt;"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/#listItem","position":5,"name":"template &lt;auto&gt;","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\/2018\/05\/23\/template-auto\/#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\/2018\/05\/23\/template-auto\/#webpage","url":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/","name":"template","description":"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template helps simplify these scenarios.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/#breadcrumblist"},"author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"datePublished":"2018-05-23T21:00:05+02:00","dateModified":"2018-05-24T13:02:58+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":"template","og:description":"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template helps simplify these scenarios.","og:url":"https:\/\/mariusbancila.ro\/blog\/2018\/05\/23\/template-auto\/","article:published_time":"2018-05-23T19:00:05+00:00","article:modified_time":"2018-05-24T11:02:58+00:00","twitter:card":"summary","twitter:title":"template","twitter:description":"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template helps simplify these scenarios."},"aioseo_meta_data":{"post_id":"2968","title":"template","description":"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template  helps simplify these scenarios.","keywords":[{"label":"c++","value":"c++"},{"label":"templates","value":"templates"},{"label":"auto","value":"auto"},{"label":"typetraits","value":"typetraits"}],"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:04:51","updated":"2025-12-12 07:49:13","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":3,"uagb_excerpt":"If you wanted to create templates with non-type template parameters, you had to specify both the type and the value. In C++17, this is no longer the case, as template &lt;auto&gt; helps simplify these scenarios.","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\">auto<\/a>","<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\">templates<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">typetraits<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">auto<\/span>","<span class=\"advgb-post-tax-term\">C++<\/span>","<span class=\"advgb-post-tax-term\">templates<\/span>","<span class=\"advgb-post-tax-term\">typetraits<\/span>"]}},"comment_count":"3","relative_dates":{"created":"Posted 8 years ago","modified":"Updated 8 years ago"},"absolute_dates":{"created":"Posted on May 23, 2018","modified":"Updated on May 24, 2018"},"absolute_dates_time":{"created":"Posted on May 23, 2018 9:00 pm","modified":"Updated on May 24, 2018 1:02 pm"},"featured_img_caption":"","series_order":"","jetpack_shortlink":"https:\/\/wp.me\/pYNdv-LS","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/2968","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=2968"}],"version-history":[{"count":7,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/2968\/revisions"}],"predecessor-version":[{"id":2975,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/2968\/revisions\/2975"}],"wp:attachment":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/media?parent=2968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/categories?post=2968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/tags?post=2968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}