scope ref const(T) --> error?!

Tove tove at fransson.se
Thu May 3 15:21:45 PDT 2012


On Thursday, 3 May 2012 at 18:28:19 UTC, Mehrdad wrote:
> What's wrong with passing a struct as scope ref const?
>
> I want to avoid copying the struct, and its information is only 
> read inside the function...

ref scope? hm? What additional semantics do you desire from that 
construct, which 'const ref' doesn't provide?

A a;

void fun(const scope ref A x)
{
   // x goes out of scope, destroy it... oops it's a global 
variable!?
}

fun(a);



More information about the Digitalmars-d mailing list