IIFE for Complex Initialization

What do you do when the code for a variable initialization is complicated? Do you move it to another method or write inside the current scope? In this blog post, I’d like to present a trick that allows computing a value for a variable, even a const variable, with a compact notation. Updated in Jan 2026: improved code, added C++26 section, added [&] section, updated code samples and added links to…