Better handling of noncopyable objects and objects with this(this)

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 1 06:57:58 PDT 2015


On Monday, 1 June 2015 at 11:03:30 UTC, Namespace wrote:
> What about
> ----
> auto h = &r.front; // can get the front of the range
> ----
> ?

hasLvalueElements checks whether you can pass the return value of 
r.front by ref and take its address. So, if you want to take the 
address of r.front, you should be using hasLvalueElements in your 
template constraint to prevent ranges which won't allow you to 
take the address of their front from being use with that function 
and resulting in compilation errors inside of the function.

- Jonathan M Davis


More information about the Digitalmars-d mailing list