Last active
April 14, 2022 13:05
-
-
Save voidbar/353d0770736c3db9d88361cfd0799073 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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