Skip to content

Instantly share code, notes, and snippets.

@talybin
Last active August 20, 2021 09:52
Show Gist options
  • Save talybin/fe2f2eddb9317c78b603504522b2138d to your computer and use it in GitHub Desktop.
Save talybin/fe2f2eddb9317c78b603504522b2138d to your computer and use it in GitHub Desktop.
Type only function (no object required)
#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();
}
@talybin
Copy link
Author

talybin commented Aug 20, 2021

42
107
11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment