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

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 2 00:36:55 PDT 2015


On Mon, 01 Jun 2015 11:03:29 +0000, Namespace wrote:

> What about ----
> auto h = &r.front; // can get the front of the range ----
> ?

there is funnier trick:
  static void testfront(T) (auto ref T n) {} testfront(r.front);

the thing is that we don't really want to check if we can take an address 
of front value, we want to keep `ref` if it's there. with this magic 
template `ref` is not stripped, but we still don't require "&" to work.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150602/53207b60/attachment.sig>


More information about the Digitalmars-d mailing list