Is it a good approach to use std::ignore
for ignoring unused variables?
Suppose I have a function like this:
void func(int i)
{
//for some reason, I don't need i anymore but I cannot change signature of function
std::ignore = i;
}
Additional Info
This was one example and some answers suggested to use anonymous variables. But how would I do it for other cases, like:
int Thread_UnSafe_func_returnSomething():
void func()
{
// To make it thread safe
// Also it is required to call only once
static int i = Thread_UnSafe_func_returnSomething();
std::ignore = i;
}