From 05f2df34290af477b0fee49b75e5f56e1d6c83f9 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 8 Dec 2018 12:58:04 +0100 Subject: Initial commit with kinda crappy unnumbered examples --- template.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 template.cpp (limited to 'template.cpp') diff --git a/template.cpp b/template.cpp new file mode 100644 index 0000000..e67645b --- /dev/null +++ b/template.cpp @@ -0,0 +1,23 @@ +#include + +template +struct vec3 { + T x; + T y; + T z; +}; + +template +int dot(vec3 v, vec3 u) { + return v.x * u.x + v.y * u.y + v.z * u.z; +} + +int main(int argc, char *argv[]) { + + vec3 v = {1, 2, 3}; + vec3 u = {1, 2, 3}; + + std::cout << dot(v, u) << std::endl; + + return 0; +} -- cgit v1.2.1