summaryrefslogtreecommitdiffstats
path: root/template.cpp
blob: e67645b7c295985d40394aace890cf7a4f617cd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
}