Last active
August 20, 2021 09:52
-
-
Save talybin/fe2f2eddb9317c78b603504522b2138d to your computer and use it in GitHub Desktop.
Type only function (no object required)
This file contains hidden or 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 <iostream> | |
struct printer | |
{ | |
template <class T> | |
constexpr void operator()(const T& t) const { | |
std::cout << t << '\n'; | |
} | |
}; | |
template <class F, int... Args> | |
struct test_t | |
{ | |
constexpr void operator()() const { | |
(F{}(Args), ...); | |
} | |
}; | |
constexpr test_t<printer, 42, 107, 11> test; | |
int main() | |
{ | |
test(); | |
} |
Author
talybin
commented
Aug 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment