Last active
September 22, 2016 17:49
-
-
Save phrz/2438dee431d15ad31f5419742716c978 to your computer and use it in GitHub Desktop.
A println function with variadic parameters for easy debugging-by-printing.
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
// [CITE] http://coliru.stacked-crooked.com/a/92a50828d6cb6f01 | |
#ifndef _PRINTLN_CPP_ | |
#define _PRINTLN_CPP_ | |
#include <iostream> | |
template<typename T> | |
void println(const T& t) { | |
std::cout << t << std::endl; | |
} | |
template<typename... Args> | |
void println(Args... a); | |
template<typename T, typename... Args> | |
void println(const T& t, const Args&... a) { | |
std::cout << t << " "; | |
println(a...); | |
} | |
template<> | |
void println() { | |
std::cout << std::endl; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment