CARB_STATIC_CACHE#

Defined in carb/Defines.h

CARB_STATIC_CACHE(...)#

Produces a static wrapper around the given args.

Effectively:

[&] {
    static auto cached = (...);
    return cached;
}()
This allows a one-time static initialization where ... is cached. Every subsequent request uses the cached value. The cached value is destroyed as per static destruction rules.

Parameters:
  • ... – The expression to cache. Will only be invoked once when called the first time.

Returns:

The cached result of the expression.