{"id":3365,"date":"2023-08-21T13:56:22","date_gmt":"2023-08-21T17:56:22","guid":{"rendered":"https:\/\/blog.wholetomato.com\/?p=3365"},"modified":"2025-11-17T06:46:53","modified_gmt":"2025-11-17T10:46:53","slug":"summer-codefest-lambdas-go-baa-recap","status":"publish","type":"post","link":"https:\/\/www.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/","title":{"rendered":"Summer Codefest: Lambdas go Baa! [Recap]"},"content":{"rendered":"<h2><span style=\"font-weight: 400;\">Webinar overview:\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">This presentation by product manager, David Millington, talks about the convenient way to define an anonymous function object added in C++11. This topic was chosen because while it&#8217;s extremely useful, the data we see is that there tend to be two groups of C++ developers: those who use them extensively, and those who barely use them.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">When to use lambdas:<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The main benefits of using lambdas are:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Improves readability for you or your team.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Anonymity makes them easier to maintain (no names needed for smaller functions\/functors).<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Localizes functions to your code.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Furthermore, lambdas are especially useful if your logic goes inside something else. These <\/span><i><span style=\"font-weight: 400;\">code layering <\/span><\/i><span style=\"font-weight: 400;\">problems are a nuisance to reading code\u2014lambdas make it easier to \u201clocalize\u201d logic.<\/span><a href=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3370\" data-permalink=\"https:\/\/www.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/screenshot-2023-08-22-at-1-51-00-am\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?fit=1722%2C968&amp;ssl=1\" data-orig-size=\"1722,968\" 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=\"Screenshot 2023-08-22 at 15100 AM\" data-image-description=\"&lt;p&gt;#image_title&lt;\/p&gt;\n\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?fit=1024%2C576&amp;ssl=1\" class=\"size-medium wp-image-3370 aligncenter\" src=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=300%2C169&#038;ssl=1\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=1536%2C863&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=1200%2C675&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=360%2C202&amp;ssl=1 360w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?w=1722&amp;ssl=1 1722w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h2><span style=\"font-weight: 400;\">Comparing lambdas with traditional functor<\/span><\/h2>\n<div id=\"attachment_3372\" style=\"width: 1034px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3372\" data-attachment-id=\"3372\" data-permalink=\"https:\/\/www.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/summer-codefest_-lambdas-go-baa-webinar-replay-16-22-screenshot\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?fit=1280%2C720&amp;ssl=1\" data-orig-size=\"1280,720\" 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=\"Summer CodeFest_ Lambdas go Baa Webinar Replay 16-22 screenshot\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?fit=1024%2C576&amp;ssl=1\" class=\"wp-image-3372 size-large\" src=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=1024%2C576&#038;ssl=1\" alt=\"\" width=\"1024\" height=\"576\" srcset=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=1200%2C675&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=360%2C203&amp;ssl=1 360w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-3372\" class=\"wp-caption-text\">A comparison between a sort functor written in traditional structure vs a lambda.<\/p><\/div>\n<p><span style=\"font-weight: 400;\">On the left is a standard functor with structs and operators written traditionally. It works and functions just as a lambda would but it is longer and arguably more difficult to comprehend when viewed in the context of actual <a href=\"https:\/\/www.wholetomato.com\/blog\/2020\/04\/14\/how-to-add-notes-and-navigation-metadata-directly-in-source-code-in-visual-studio\/\">source code<\/a>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">On the other hand, a lambda is seen as significantly shorter and easier to read. With the structure of a lambda, the code being called is emphasized directly after the functions. The syntax is also unmistakable; just look for the following method syntax:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">[ ] &#8211; capture state<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">( ) &#8211; function<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">{ } &#8211; body of method<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Skip to <\/span><a href=\"https:\/\/youtu.be\/0tKmDIRsq8o?t=1098\"><span style=\"font-weight: 400;\">18:18 of the replay<\/span><\/a><span style=\"font-weight: 400;\"> to learn more about lambda syntax and how to structure inline functions.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Summary: other tips for using lambdas<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Here are a couple of other things you should look out for according to the presentation:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/youtu.be\/0tKmDIRsq8o?t=1298\"><span style=\"font-weight: 400;\">Variable capture<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/youtu.be\/0tKmDIRsq8o?t=1421\"><span style=\"font-weight: 400;\">Using auto for the type<\/span><\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3374\" data-permalink=\"https:\/\/www.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/summer-codefest_-lambdas-go-baa-webinar-replay-27-27-screenshot\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?fit=1280%2C720&amp;ssl=1\" data-orig-size=\"1280,720\" 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=\"Summer CodeFest_ Lambdas go Baa Webinar Replay 27-27 screenshot\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?fit=1024%2C576&amp;ssl=1\" class=\"alignnone wp-image-3374\" src=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=738%2C415&#038;ssl=1\" alt=\"\" width=\"738\" height=\"415\" srcset=\"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=1200%2C675&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=360%2C203&amp;ssl=1 360w, https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h2><span style=\"font-weight: 400;\">Slide Deck Presentation<\/span><\/h2>\n<p><iframe loading=\"lazy\" src=\"https:\/\/docs.google.com\/presentation\/d\/e\/2PACX-1vTiu3zxkG2_R-sNvYrjVuqhWL4jaJfK8_n8Nbgsx_j0YeKoqD1WykAe0qC6cJjRFnX8E8vrmNIBP-i7\/embed?start=false&amp;loop=false&amp;delayms=3000\" width=\"760\" height=\"469\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h2><span style=\"font-weight: 400;\">Replay<\/span><\/h2>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/0tKmDIRsq8o\" width=\"760\" height=\"415\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Webinar overview:\u00a0 This presentation by product manager, David Millington, talks about the convenient way to define an anonymous function object added in C++11. This topic was chosen because while it&#8217;s extremely useful, the data we&#8230;<\/p>\n","protected":false},"author":213500340,"featured_media":3367,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[672,726359896],"tags":[2426,726359933,726359934,726359932],"class_list":["post-3365","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-and-tricks","category-webinar-recap","tag-c","tag-functions","tag-functors","tag-lambdas"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/16_WTSummer-CodeFest-Individual-Sessions_David-Millington-1920x1080-1.png?fit=1920%2C1080&ssl=1","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfpLS4-Sh","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/users\/213500340"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/comments?post=3365"}],"version-history":[{"count":8,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3365\/revisions"}],"predecessor-version":[{"id":3500,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3365\/revisions\/3500"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/media\/3367"}],"wp:attachment":[{"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/media?parent=3365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/categories?post=3365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wholetomato.com\/blog\/wp-json\/wp\/v2\/tags?post=3365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}