Null references

Nick Treleaven nospam at example.net
Fri Aug 24 08:17:43 PDT 2012


On 23/08/2012 18:27, Namespace wrote:
> Is there any special reason why these functions doesn't get "Maybe" as
> (const) ref?
>
> void show(T)(Maybe!T m)
> bool opEquals(Maybe!T m)
> void opAssign(Maybe!T m)

No special reason. The Maybe struct is usually pretty small so using ref 
didn't occur to me, but if it's good practice I should do so. I suppose 
ref would be necessary because T could be a struct. I hadn't thought 
about const at all yet.

BTW show is just a test function, I recently made it private.

Nick


More information about the Digitalmars-d mailing list