ideas about ranges

Daniel Keep daniel.keep.lists at gmail.com
Sat May 23 05:47:47 PDT 2009



Andrei Alexandrescu wrote:
> Steven Schveighoffer wrote:
>> ref accomplishes all of this, except you can't get at the underlying
>> pointer to do things like compare to null or rebind.  Maybe we simply
>> need some new operators to get at the ref addresses.
> 
> Defining null references has been on the table too. I wrote a paragraph
> about them and then deleted it in fear of major aggravation.
> 
> There's no need for new syntax. We can easily define things such that
> you can return *null when a reference is expected and checking
> &(r.popNext()) is null to figure out what's happening. I think it's bad
> design though.
> 
> 
> Andrei

Why not have something along these lines:

bool isrefset(T)(ref T r)
{
    return (&r !is null);
}

Then you don't have to dirty yourself by directly using pointers.  :)



More information about the Digitalmars-d mailing list