Skip to content

Instantly share code, notes, and snippets.

@phrz
Last active September 22, 2016 17:49
Show Gist options
  • Save phrz/2438dee431d15ad31f5419742716c978 to your computer and use it in GitHub Desktop.
Save phrz/2438dee431d15ad31f5419742716c978 to your computer and use it in GitHub Desktop.
A println function with variadic parameters for easy debugging-by-printing.
// [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