summaryrefslogtreecommitdiffstats
path: root/template.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--template.cpp23
1 files changed, 23 insertions, 0 deletions
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 <iostream>
+
+template<typename T>
+struct vec3 {
+ T x;
+ T y;
+ T z;
+};
+
+template<typename T>
+int dot(vec3<T> v, vec3<T> u) {
+ return v.x * u.x + v.y * u.y + v.z * u.z;
+}
+
+int main(int argc, char *argv[]) {
+
+ vec3<int> v = {1, 2, 3};
+ vec3<int> u = {1, 2, 3};
+
+ std::cout << dot(v, u) << std::endl;
+
+ return 0;
+}