AM
Size: a a a
AM
AM
AM
AM
J
AM
TL
L
L
MT
template <typename... _Args>
foo1 (_Args &&... args) {
//Some magic that expands into:
//foo2(arg1);
//foo2(arg2);
//foo2(arg3);
//...
}
☀m
#include <iostream>
using namespace std;
template <class T>
void foo2(T&& smth)
{
cout<<smth+smth<<endl;
}
template <class ... Args>
void foo1(Args&& ... args)
{
(..., (foo2(args)));
}
int main()
{
foo1(2, 3.14, "hello"s);
return 0;
}
RN
RN
TS
RN
RN
RN
TS
auto f = []<typename... Args>(Args... args) -> std::ostream& {
return (std::cout << ... << args);
};
f(1, 2, "hello") << std::endl;
f(3, 4) << std::endl;
12hello
34
TS
auto f = []<typename... Args>(Args... args) -> std::ostream& {
return (std::cout << ... << args);
};
f(1, 2, "hello") << std::endl;
f(3, 4) << std::endl;
12hello
34