I've effectively got the following problem: I want to be able to build with -Wall -Wextra -Werror
, however, the following code will complain about unused parameters:
struct foo
{
template <typename... Args>
static void bar()
{ }
template <typename T, typename ... Args>
static void bar(T&& value, Args&& ... args)
{
#ifdef DEBUG
std::cout << value;
bar(std::forward<Args>(args)...);
#endif
}
};
The first unused parameter is easy to fix:
#ifdef DEBUG
std::cout << value;
bar(std::forward<Args>(args)...);
#else // Shut the compiler up
(void) value;
#endif
My question is, how can I do this with the remaining args
? Neither
(void)(args...);
Nor
(void)(args)...;
will work, both complain about the parameter pack not being expanded.
(This is under GCC 4.7.3, if that will make any difference to a potential solution).