More complete operator overloading
This commit is contained in:
parent
ca34a0640e
commit
459be4704a
12
actypes.d
12
actypes.d
|
@ -90,7 +90,7 @@ public:
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
int opCmp(ref const ACSymbol other) const
|
||||
int opCmp(ref const ACSymbol other) const pure nothrow @safe
|
||||
{
|
||||
// Compare the pointers because the strings have been interned.
|
||||
// Identical strings MUST have the same address
|
||||
|
@ -101,6 +101,16 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool opEquals(ref const ACSymbol other) const pure nothrow @safe
|
||||
{
|
||||
return other.name.ptr == this.name.ptr;
|
||||
}
|
||||
|
||||
size_t toHash() const pure nothrow @safe
|
||||
{
|
||||
return (cast(size_t) name.ptr) * 27_644_437;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all parts whose name matches the given string.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue