Add some more checkers.

Change the result of `operator=` on `Mod` to return `Mod&`.  In this
example:

```c++
Mod<4, int> a;
int b = (a = 8);
```

The value of `b` will now be 0, not 8, and will equal the value of `a`.
Hopefully this is less confusing to users of this class.
This commit is contained in:
David Chisnall
2019-04-29 15:14:43 +01:00
parent 22d33ebf99
commit b5bc09ced3
2 changed files with 9 additions and 3 deletions

View File

@@ -53,10 +53,10 @@ namespace snmalloc
return static_cast<T>(value & (length - 1));
}
T& operator=(const T v)
Mod& operator=(const T v)
{
value = v;
return value;
return *this;
}
};