Complex Object Initialization Optimization with IIFE in C++11 -- Jason Turner
A few days ago on EmptyCrate:
Complex Object Initialization Optimization with IIFE in C++11
by Jason Turner
From the article:
IIFE (Immediately-Invoked Function Expression) is a common tool used in JavaScript. The idea is to both define an anonymous function and call it in the same expression. The point is to produce a local scope for variables so they do not pollute the global scope.
This same technique can be deployed in C++ to lead to cleaner, safer, more performant code when building up objects which require multiple steps to initialize...


[We don't often link to quiz-like sites, particularly product-specific ones, but in this case we felt that this could be of broad interest to some of our readers. -- Ed.]
Fresh on CoderGears: