gtopt/warn_once.hpp file

Thread-safe "log this warning only once" helper.

LP assembly runs on WorkPool threads, so a function-local static bool warned flag is a data race. Use a function-local static WarnOnceFlag instead (constant-initialised, so its construction is race-free too):

static WarnOnceFlag warned;
warn_once(warned, "mode '{}' is not supported", name);

Namespaces

namespace gtopt

Classes

class gtopt::WarnOnceFlag