microbit: added comparators to CompassSample

Added two new comparator operations equals and not equals to make the
task of comparing two CompassSamples Simpler.
master
James Devine 2016-02-02 20:41:40 +00:00
parent 5e7334b0bf
commit 0412a5b322
1 changed files with 10 additions and 0 deletions

View File

@ -97,6 +97,16 @@ struct CompassSample
this->y = y;
this->z = z;
}
bool operator==(const CompassSample& other) const
{
return x == other.x && y == other.y && z == other.z;
}
bool operator!=(const CompassSample& other) const
{
return !(x == other.x && y == other.y && z == other.z);
}
};
/**