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:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user