I wrote a small coordinate class to handle both int and float coordinates.
template
class vector2
{
public:
vector2() { memset(this, 0, s
No don't use memset
-- it zeroes out the size of a pointer (4 bytes on my x86 Intel machine) bytes starting at the location pointed by this
. This is a bad habit: you will also zero out virtual pointers and pointers to virtual bases when using memset
with a complex class. Instead do:
template
class vector2
{
public:
// use initializer lists
vector2() : x(0), y(0) {}
T x;
T y;
};