Created
September 10, 2018 19:32
-
-
Save StefanoBelli/665880274ecf1195ae81c2648a45307b to your computer and use it in GitHub Desktop.
This file contains 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
#ifndef PRINT_H | |
#define PRINT_H | |
#include <iostream> | |
#include <utility> | |
template<typename Ty> | |
void print(Ty&& p) { std::cout << std::forward<Ty>(p); } | |
template <typename First, typename ...Many> | |
void print(First&& f, Many&&... a) { | |
std::cout << std::forward<First>(f); | |
print(std::forward<Many>(a)...); | |
} | |
template<typename Ty> | |
void println(Ty&& p) { std::cout << std::forward<Ty>(p) << '\n'; } | |
template <typename First, typename ...Many> | |
void println(First&& f, Many&&... a) { | |
print(std::forward<First>(f), std::forward<Many>(a)...); | |
std::cout << '\n'; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment