Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Provides a mechanism for calling a specified callable object exactly once during execution.
template<class Callable, class... Args>
void call_once(once_flag& Flag,
Callable F&&, Args&&... A);
Parameters
Flag
A once_flag object that ensures that the callable object is only called once.F
A callable object.A
An argument list.
Remarks
If Flag is not valid, the function throws a system_error that has an error code of invalid_argument. Otherwise, the template function uses its Flag argument to ensure that it calls F(A...) successfully exactly once, regardless of how many times the template function is called. If F(A...) exits by throwing an exception, the call was not successful.
Requirements
Header: mutex
Namespace: std