1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
   | #ifndef VEC3_H
#define VEC3_H
 
#include <iostream>
 
template <typename T>
enum T { int, double };
 
template <typename T>
class Vec3
{
public:
	T x;
	T y;
	T z;
 
	Vec3(void);
	~Vec3(void);
 
	void set(const T &_x, const T &_y, const T &_z);
	void print();
};
 
template <>
Vec3<T>::Vec3(void)
{
}
 
template <>
Vec3<T>::~Vec3(void)
{
}
 
template <>
void Vec3<T>::set(const T &_x, const T &_y, const T &_z)
{
	x = _x; y = _y; z = _z;
}
 
template <>
void Vec3<T>::print()
{
	std::cout<<x<<" "<<y<<" "<<z<<std::endl;
}
 
#endif | 
Partager