Bug 1354090: P2. Add operator+(val). r=gerald

Such that:
[x, y] + a = [x+a, y+a]

MozReview-Commit-ID: HlyI9KmVtTg

--HG--
extra : rebase_source : ef5d9e942d365fbcffd796a1762bd89a042272e7
This commit is contained in:
Jean-Yves Avenard 2017-04-07 11:31:00 +02:00
parent fa2ce72185
commit 137766e6ad

View File

@ -101,6 +101,11 @@ public:
mFuzz + aOther.mFuzz);
}
SelfType operator+ (const T& aVal) const
{
return SelfType(mStart + aVal, mEnd + aVal, mFuzz);
}
// Basic interval arithmetic operator definition.
SelfType operator- (const SelfType& aOther) const
{
@ -109,6 +114,11 @@ public:
mFuzz + aOther.mFuzz);
}
SelfType operator- (const T& aVal) const
{
return SelfType(mStart - aVal, mEnd - aVal, mFuzz);
}
bool operator== (const SelfType& aOther) const
{
return mStart == aOther.mStart && mEnd == aOther.mEnd;