microbit: added comparators to CompassSample
Added two new comparator operations equals and not equals to make the task of comparing two CompassSamples Simpler.
This commit is contained in:
parent
5e7334b0bf
commit
0412a5b322
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue