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...
Add a Comment
Comments are closed.