invoke_noreturn_cold
Declared in <folly/lang/Exception.h>
template<
typename F,
typename... A>
[[noreturn]]
void
invoke_noreturn_cold(
F&& f,
A&&... a) noexcept(/* see-below */);
Invoke the provided function with the provided arguments. If the invocation returns, terminate.
May be used with throw_exception in cases where construction of the object to be thrown requires more than just invoking its constructor with a given sequence of arguments passed by reference - for example, if a string message must be computed before being passed to the constructor of the object to be thrown.
Usage note: Passing extra values as arguments rather than capturing them allows smaller inlined native code at the call-site.
Example:
if (i < 0) { invoke_noreturn_cold( []j) { throw_exceptions(runtime_error(to<string>("invalid: ", j))); }, i); }
This function is potentially-throwing unless noexcept(static_cast<F &&>(f)(static_cast<A &&>(a)...)).
This function does not return.
| Name | Description |
|---|---|
| f | The function to invoke. |
| a | The arguments to forward to the function. |