Skip to content

Instantly share code, notes, and snippets.

@keisukefukuda
Last active September 17, 2015 04:44
Show Gist options
  • Save keisukefukuda/0669a7326ee7aab2aa00 to your computer and use it in GitHub Desktop.
Save keisukefukuda/0669a7326ee7aab2aa00 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cassert>
#include <cstdlib>
int multiply(int x, int y) {
return x * y;
}
void type_safe_print() {
std::cout << std::endl;
}
template<class T, class ...Args>
void type_safe_print(T val, Args...args) {
std::cout << val;
type_safe_print(args...);
}
int main(int argc, char **argv) {
assert(argc == 3);
int a = atoi(argv[1]);
int b = atoi(argv[2]);
type_safe_print(a, " x ", b, " = ", multiply(a,b));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment