Skip to content

Instantly share code, notes, and snippets.

@voidbar
Last active April 14, 2022 13:05
Show Gist options
  • Save voidbar/353d0770736c3db9d88361cfd0799073 to your computer and use it in GitHub Desktop.
Save voidbar/353d0770736c3db9d88361cfd0799073 to your computer and use it in GitHub Desktop.
#include <tuple>
template <typename... Args>
constexpr void ignore0(Args... args)
{
constexpr auto dummy = [](auto&& a) { std::ignore = a;};
(dummy(std::forward<Args>(args)), ...);
}
template <typename... Args>
constexpr void ignore1(Args... args)
{
std::ignore = std::tuple<Args...>(args...);
}
template <typename... Args>
constexpr void ignore2([[maybe_unused]] Args... args)
{
}
template <typename... Args>
constexpr void ignore3(Args...)
{
}
int foo(int a, int b)
{
ignore0(a, b);
ignore1(a, b);
ignore2(a, b);
return 42;
}
int main()
{
return foo(3425, 8);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment