Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename... Args>
- void print(const Args&... args) {
- (std::cout << ... << args);
- }
- template<typename... Args>
- void print(const Args&... args) {
- auto f{[](auto&& x) { cout << x << " "; }};
- (f(args),...);
- }
- template<typename... Args>
- void print(const char * delim, const Args&... args) {
- auto f{[delim](auto&& x) { cout << x << delim; }};
- (f(args),...);
- }
- template<typename... Args>
- void print(const char * delim, const Args&... args) {
- int count = sizeof...(args);
- auto f{[delim, &count](auto&& x) { cout << x; if (--count) cout << delim; }};
- (f(args),...);
- }
Add Comment
Please, Sign In to add comment