{"id":1194,"date":"2016-09-14T15:23:37","date_gmt":"2016-09-14T15:23:37","guid":{"rendered":"http:\/\/ninecrows.com\/career\/?p=1194"},"modified":"2016-09-14T15:23:37","modified_gmt":"2016-09-14T15:23:37","slug":"and-a-quick-jag-into-metaprogramming","status":"publish","type":"post","link":"https:\/\/ninecrows.com\/career\/2016\/09\/14\/and-a-quick-jag-into-metaprogramming\/","title":{"rendered":"&#8230;and a quick jag into metaprogramming&#8230;"},"content":{"rendered":"<p>I&#8217;ve tried to dig into C++ template metaprogramming a number of times in the past. In general I&#8217;ve found that the techniques were clever but I haven&#8217;t found any places where I felt they&#8217;d be an improvement over the things I&#8217;m already doing.<\/p>\n<p>Given there is quite a bit going on in this area and the standard library and boost both use metaprogramming techniques extensively, I&#8217;m diving in again. I&#8217;m back in the C++ world and working in a C++ 2011 compliant environment so I&#8217;m going to put a bit more energy into this dive and see if I can come away with useful techniques in addition to the curious but seemingly over-complex bits I&#8217;ve seen in the past.<\/p>\n<p><!--more--><\/p>\n<p>I&#8217;m starting with my older and thinner book <a href=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51qxXO57fsL._SX400_BO1204203200_.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1196\" data-permalink=\"https:\/\/ninecrows.com\/career\/2016\/09\/14\/and-a-quick-jag-into-metaprogramming\/51qxxo57fsl-_sx400_bo1204203200_\/\" data-orig-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51qxXO57fsL._SX400_BO1204203200_.jpg?fit=402%2C500&amp;ssl=1\" data-orig-size=\"402,500\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"51qxxo57fsl-_sx400_bo1204203200_\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51qxXO57fsL._SX400_BO1204203200_.jpg?fit=241%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51qxXO57fsL._SX400_BO1204203200_.jpg?fit=402%2C500&amp;ssl=1\" class=\"alignleft size-thumbnail wp-image-1196\" src=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51qxXO57fsL._SX400_BO1204203200_.jpg?resize=150%2C150\" alt=\"51qxxo57fsl-_sx400_bo1204203200_\" width=\"150\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51qxXO57fsL._SX400_BO1204203200_.jpg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51qxXO57fsL._SX400_BO1204203200_.jpg?zoom=2&amp;resize=150%2C150 300w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><a href=\"https:\/\/www.amazon.com\/Template-Metaprogramming-Concepts-Techniques-Beyond\/dp\/0321227255\/ref=sr_1_3?ie=UTF8&amp;qid=1473865909&amp;sr=8-3&amp;keywords=c%2B%2B+template\">C++ Template Metaprogramming<\/a> which seems to be a bit easier of a read.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>I&#8217;ll<a href=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51hiVtb-yJL._SX348_BO1204203200_.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1197\" data-permalink=\"https:\/\/ninecrows.com\/career\/2016\/09\/14\/and-a-quick-jag-into-metaprogramming\/51hivtb-yjl-_sx348_bo1204203200_\/\" data-orig-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51hiVtb-yJL._SX348_BO1204203200_.jpg?fit=350%2C499&amp;ssl=1\" data-orig-size=\"350,499\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"51hivtb-yjl-_sx348_bo1204203200_\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51hiVtb-yJL._SX348_BO1204203200_.jpg?fit=210%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51hiVtb-yJL._SX348_BO1204203200_.jpg?fit=350%2C499&amp;ssl=1\" class=\"alignleft size-thumbnail wp-image-1197\" src=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51hiVtb-yJL._SX348_BO1204203200_.jpg?resize=150%2C150\" alt=\"51hivtb-yjl-_sx348_bo1204203200_\" width=\"150\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51hiVtb-yJL._SX348_BO1204203200_.jpg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/51hiVtb-yJL._SX348_BO1204203200_.jpg?zoom=2&amp;resize=150%2C150 300w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a> likely then hop over to <a href=\"https:\/\/www.amazon.com\/Advanced-Metaprogramming-Classic-Davide-Gennaro\/dp\/1484210115\/ref=pd_sim_14_6?ie=UTF8&amp;psc=1&amp;refRID=CRJH644YEWZT5MNA1B5K\">Advanced Metaprogramming in Classic C++<\/a> which looks more comprehensive (if perhaps a little dated) but is definitely harder to get started on.<\/p>\n<p>&nbsp;<\/p>\n<p>I&#8217;ve ordered a few books that seem to also look interesting:<\/p>\n<ul>\n<li><a href=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/71XmotAbKBL._SX401_BO1204203200_.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1200\" data-permalink=\"https:\/\/ninecrows.com\/career\/2016\/09\/14\/and-a-quick-jag-into-metaprogramming\/71xmotabkbl-_sx401_bo1204203200_\/\" data-orig-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/71XmotAbKBL._SX401_BO1204203200_.jpg?fit=403%2C500&amp;ssl=1\" data-orig-size=\"403,500\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"71xmotabkbl-_sx401_bo1204203200_\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/71XmotAbKBL._SX401_BO1204203200_.jpg?fit=242%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/71XmotAbKBL._SX401_BO1204203200_.jpg?fit=403%2C500&amp;ssl=1\" class=\"alignleft size-thumbnail wp-image-1200\" src=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/71XmotAbKBL._SX401_BO1204203200_.jpg?resize=150%2C150\" alt=\"71xmotabkbl-_sx401_bo1204203200_\" width=\"150\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/71XmotAbKBL._SX401_BO1204203200_.jpg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/71XmotAbKBL._SX401_BO1204203200_.jpg?zoom=2&amp;resize=150%2C150 300w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><a href=\"https:\/\/www.amazon.com\/Modern-Design-Generic-Programming-Patterns\/dp\/0201704315\/ref=pd_sim_14_5?ie=UTF8&amp;psc=1&amp;refRID=8KZYT3M6968XQ3KT21Q0\">Modern C++ Design: Generic Programming and Design Patterns Applied<\/a> which is older but seems to get good reviews (and I got a used copy for cheap on Amazon).<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li><a href=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/512ODGCyTEL._SX398_BO1204203200_.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1199\" data-permalink=\"https:\/\/ninecrows.com\/career\/2016\/09\/14\/and-a-quick-jag-into-metaprogramming\/512odgcytel-_sx398_bo1204203200_\/\" data-orig-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/512ODGCyTEL._SX398_BO1204203200_.jpg?fit=400%2C500&amp;ssl=1\" data-orig-size=\"400,500\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"512odgcytel-_sx398_bo1204203200_\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/512ODGCyTEL._SX398_BO1204203200_.jpg?fit=240%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/512ODGCyTEL._SX398_BO1204203200_.jpg?fit=400%2C500&amp;ssl=1\" class=\"alignleft size-thumbnail wp-image-1199\" src=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/512ODGCyTEL._SX398_BO1204203200_.jpg?resize=150%2C150\" alt=\"512odgcytel-_sx398_bo1204203200_\" width=\"150\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/512ODGCyTEL._SX398_BO1204203200_.jpg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/512ODGCyTEL._SX398_BO1204203200_.jpg?zoom=2&amp;resize=150%2C150 300w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><a href=\"https:\/\/www.amazon.com\/Discovering-Modern-Scientists-Programmers-Depth\/dp\/0134383583\/ref=pd_sim_14_11?ie=UTF8&amp;psc=1&amp;refRID=8KZYT3M6968XQ3KT21Q0\">Discovering Modern C++<\/a> which looks newer and perhaps more of a gentle introduction.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li><a href=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/41abkzXySRL._SX397_BO1204203200_.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1198\" data-permalink=\"https:\/\/ninecrows.com\/career\/2016\/09\/14\/and-a-quick-jag-into-metaprogramming\/41abkzxysrl-_sx397_bo1204203200_\/\" data-orig-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/41abkzXySRL._SX397_BO1204203200_.jpg?fit=399%2C499&amp;ssl=1\" data-orig-size=\"399,499\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"41abkzxysrl-_sx397_bo1204203200_\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/41abkzXySRL._SX397_BO1204203200_.jpg?fit=240%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/41abkzXySRL._SX397_BO1204203200_.jpg?fit=399%2C499&amp;ssl=1\" class=\"alignleft size-thumbnail wp-image-1198\" src=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/41abkzXySRL._SX397_BO1204203200_.jpg?resize=150%2C150\" alt=\"41abkzxysrl-_sx397_bo1204203200_\" width=\"150\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/41abkzXySRL._SX397_BO1204203200_.jpg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/ninecrows.com\/career\/wp-content\/uploads\/2016\/09\/41abkzXySRL._SX397_BO1204203200_.jpg?zoom=2&amp;resize=150%2C150 300w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><a href=\"https:\/\/www.amazon.com\/gp\/product\/1617290262\/ref=oh_aui_detailpage_o00_s00?ie=UTF8&amp;psc=1\">Metaprogramming in .NET<\/a> because .NET is also an interesting environment and I&#8217;m curious whether it is as crippled as java generics. I suspect that it isn&#8217;t as Microsoft has been more willing to make forward looking changes to their VMs to support useful new functionality.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve tried to dig into C++ template metaprogramming a number of times in the past. In general I&#8217;ve found that the techniques were clever but I haven&#8217;t found any places where I felt they&#8217;d be an improvement over the things I&#8217;m already doing. Given there is quite a bit going on in this area and &hellip; <a href=\"https:\/\/ninecrows.com\/career\/2016\/09\/14\/and-a-quick-jag-into-metaprogramming\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">&#8230;and a quick jag into metaprogramming&#8230;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_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","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-1194","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7F2Qc-jg","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/1194"}],"collection":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/comments?post=1194"}],"version-history":[{"count":2,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/1194\/revisions"}],"predecessor-version":[{"id":1201,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/1194\/revisions\/1201"}],"wp:attachment":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/media?parent=1194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/categories?post=1194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/tags?post=1194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}