SetFlag overloads

Synopses

Declared in <absl/flags/flag.h>

Sets the value of an absl::Flag to the value v. Do not construct an absl::Flag<T> directly and call absl::SetFlag(); instead, use the flag's variable name (e.g. FLAGS_name). This function is thread‐safe, but is potentially expensive. Avoid setting flags in general, but especially within performance‐critical code.

template<typename T>
void
SetFlag(
    absl::Flag<T>* flag,
    T const& v);

Overload of SetFlag() to allow callers to pass in a value that is convertible to T. E.g., use this overload to pass a "const char*" when T is std::string.

template<
    typename T,
    typename V>
void
SetFlag(
    absl::Flag<T>* flag,
    V const& v);

Parameters

Name

Description

flag

The flag to update.

v

The new value to assign to flag.

Created with MrDocs