I really had the following problem: I want to be able to build using -Wall -Wextra -Werror , however the following code will complain about unused options:
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 complain about a parameter package that is not expandable.
(This is under GCC 4.7.3, if it will make any difference to the potential solution).
source share