IIFE

What is the purpose of this pattern?

const auto config = [&]() {
    Config c;
    c.timeout = parseTimeout(args);
    c.retries = parseRetries(args);
    if (c.retries > 10) c.retries = 10;
    return c;
}();
A

It defers initialization of config until the variable is first accessed

B

It creates a reusable factory function that can be called later to produce Config objects

C

It allows complex initialization logic for a const variable that couldn't be done with a simple initializer expression

D

It runs the lambda on a separate thread to avoid blocking the main thread during initialization