What's the correct opEquals signature for structs?

Johannes Pfau nospam at example.com
Tue Mar 13 11:29:35 PDT 2012


Am Tue, 13 Mar 2012 19:28:26 +0100
schrieb Johannes Pfau <nospam at example.com>:

> My std.uuid module doesn't compile with the latest dmd. I guess it's
> because of a wrong opEquals signature, this is what I have now:
> 
> ----------
> @safe pure nothrow bool opEquals(ref const UUID s) const
> {
>     return s.data == this.data;
> }
> ----------
> 
> and
> 
> ----------
> assert(UUID("00000000-0000-0000-0000-000000000000") == nilUUID);
> ----------
> The complete code is here:
> https://github.com/jpf91/phobos/blob/std.uuid/std/uuid.d
> 
> What's the best way to solve this issue?

sorry, forgot the error message:
--------
Error: function std.uuid.UUID.opEquals (ref
const(UUID) s) const is not callable using argument types (UUID)
Error:
UUID([cast(ubyte)138u,cast(ubyte)179u,cast(ubyte)6u,cast(ubyte)14u,cast(ubyte)44u,cast(ubyte)186u,cast(ubyte)79u,cast(ubyte)35u,cast(ubyte)183u,cast(ubyte)76u,cast(ubyte)181u,cast(ubyte)45u,cast(ubyte)179u,cast(ubyte)189u,cast(ubyte)251u,cast(ubyte)70u])
is not an lvalue
--------


More information about the Digitalmars-d-learn mailing list