mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 06:00:35 +03:00
fix opEquals type
This commit is contained in:
parent
78d04c9566
commit
1b0d9811c3
3 changed files with 12 additions and 7 deletions
|
@ -297,12 +297,12 @@ struct BitArray
|
|||
size_t len;
|
||||
uint* ptr;
|
||||
|
||||
size_t dim()
|
||||
const size_t dim()
|
||||
{
|
||||
return (len + 31) / 32;
|
||||
}
|
||||
|
||||
size_t length()
|
||||
const size_t length()
|
||||
{
|
||||
return len;
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ struct BitArray
|
|||
* Support for operators == and != for bit arrays.
|
||||
*/
|
||||
|
||||
bool opEquals(BitArray a2)
|
||||
const bool opEquals(const ref BitArray a2)
|
||||
{ int i;
|
||||
|
||||
if (this.length != a2.length)
|
||||
|
|
11
std/boxer.d
11
std/boxer.d
|
@ -208,7 +208,7 @@ struct Box
|
|||
}
|
||||
|
||||
/** Return whether this value could be unboxed as the given type without throwing. */
|
||||
bool unboxable(TypeInfo test)
|
||||
bool unboxable(TypeInfo test) const
|
||||
{
|
||||
if (type is test)
|
||||
return true;
|
||||
|
@ -335,9 +335,14 @@ struct Box
|
|||
* Compare this box's value with another box. This implicitly casts if the
|
||||
* types are different, identical to the regular type system.
|
||||
*/
|
||||
bool opEquals(Box other)
|
||||
const bool opEquals(const ref Box other)
|
||||
{
|
||||
return opEqualsInternal(other, false);
|
||||
return (cast(Box)this).opEqualsInternal(cast(Box)other, false);
|
||||
}
|
||||
|
||||
const bool opEquals(Box other)
|
||||
{
|
||||
return (cast(Box)this).opEqualsInternal(other, false);
|
||||
}
|
||||
|
||||
private float opCmpInternal(Box other, bool inverted)
|
||||
|
|
|
@ -242,7 +242,7 @@ Always $(D false) (random generators are infinite ranges).
|
|||
/**
|
||||
Compares against $(D_PARAM rhs) for equality.
|
||||
*/
|
||||
bool opEquals(LinearCongruentialEngine rhs) const
|
||||
bool opEquals(ref const LinearCongruentialEngine rhs) const
|
||||
{
|
||||
return _x == rhs._x;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue