Run Code
|
Code Wall
|
Users
|
Misc
|
Feedback
|
About
|
Login
|
Theme
for_each_argument
#include <functional> #include <iostream> using namespace std; template <typename F, typename... Args> void for_each_argument(F f, Args&&... args) { using t = int[sizeof...(Args)]; (void)t{(f(forward<Args>(args)), 0)...}; } struct print { template <typename T> void operator()(const T& x) const { cout << x << endl; } }; int main() { for_each_argument(print(), 10, "Hello", 42.5); }
run
|
edit
|
history
|
help
1
Please
log in
to post a comment.
void pointer
Magic, why 1 2?
Access namespace by unqualified manner
Thread-safe Interval Average Calculator
Test bitfields with unnamed union
Non type template argument
Dash-D compiler flag example
Argument passing by using reference and value
Erase a std::unordered_map::local_iterator by key
HTML Timetable generator.cpp
Please log in to post a comment.