2015-06-06 16:45:09 -07:00
|
|
|
// Presenting: Dumber, the dumb number
|
|
|
|
// this is just some C++ bloat-i-mean-boilerplate
|
|
|
|
// for inheritance in vector types.
|
|
|
|
|
|
|
|
TEMPLATE
|
|
|
|
struct DumberBase {
|
|
|
|
T v;
|
|
|
|
|
|
|
|
inline
|
|
|
|
DumberBase()
|
|
|
|
{}
|
|
|
|
|
|
|
|
inline
|
|
|
|
DumberBase(T v2)
|
|
|
|
{ v = v2; }
|
|
|
|
|
|
|
|
inline
|
|
|
|
DumberBase(const DumberBase &x)
|
|
|
|
{ v = x.v; }
|
|
|
|
|
|
|
|
inline DumberBase&
|
|
|
|
operator=(const DumberBase& v2) {
|
|
|
|
v = v2.v;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DumberBase
|
2015-06-06 17:25:18 -07:00
|
|
|
operator-()
|
|
|
|
{ return -v; }
|
2015-06-06 16:45:09 -07:00
|
|
|
|
|
|
|
inline DumberBase
|
2015-06-06 17:25:18 -07:00
|
|
|
operator+(const DumberBase &v2)
|
|
|
|
{ return v + v2.v; }
|
2015-06-06 16:45:09 -07:00
|
|
|
|
|
|
|
inline DumberBase
|
2015-06-06 17:25:18 -07:00
|
|
|
operator-(const DumberBase &v2)
|
|
|
|
{ return v - v2.v; }
|
2015-06-06 16:45:09 -07:00
|
|
|
|
|
|
|
inline DumberBase
|
|
|
|
operator*(const DumberBase &v2)
|
2015-06-06 17:25:18 -07:00
|
|
|
{ return v*v2.v; }
|
2015-06-06 16:45:09 -07:00
|
|
|
|
|
|
|
inline DumberBase
|
|
|
|
operator/(const DumberBase &v2)
|
2015-06-06 17:25:18 -07:00
|
|
|
{ return v/v2.v; }
|
2015-06-06 16:45:09 -07:00
|
|
|
|
|
|
|
inline DumberBase&
|
|
|
|
operator+=(const DumberBase &v2)
|
|
|
|
{
|
|
|
|
v = v + v2.v;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DumberBase&
|
|
|
|
operator-=(const DumberBase &v2)
|
|
|
|
{
|
|
|
|
v = v - v2.v;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DumberBase&
|
|
|
|
operator*=(const DumberBase &v2)
|
|
|
|
{
|
2015-06-06 17:25:18 -07:00
|
|
|
v = v*v2.v;
|
2015-06-06 16:45:09 -07:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DumberBase&
|
|
|
|
operator/=(const DumberBase &v2)
|
|
|
|
{
|
2015-06-06 17:25:18 -07:00
|
|
|
v = v/v2.v;
|
2015-06-06 16:45:09 -07:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
TEMPLATE
|
|
|
|
struct Dumber : public DumberBase<T> {
|
|
|
|
inline
|
|
|
|
Dumber()
|
|
|
|
{}
|
|
|
|
|
|
|
|
inline
|
|
|
|
Dumber(DumberBase<T> v2) : DumberBase<T>(v2)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|