Re: manually call opUnary

2014-11-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 04, 2014 07:19:03 Algo via Digitalmars-d-learn wrote: > Is it possible? > As in > { > int a; > a.opUnary!"++"(); > } > no property 'opUnary' for type 'int' opUnary only exists when it's been declared on a user-defined type. The way to use it generically is to use t

Re: manually call opUnary

2014-11-03 Thread Algo via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 07:49:15 UTC, Rikki Cattermole wrote: On 4/11/2014 8:19 p.m., Algo wrote: Is it possible? As in { int a; a.opUnary!"++"(); } no property 'opUnary' for type 'int' For primitives it doesn't look like it. To confirm this, we'll first figure out what TypeI

Re: manually call opUnary

2014-11-03 Thread Algo via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 07:19:05 UTC, Algo wrote: Is it possible? As in { int a; a.opUnary!"++"(); } no property 'opUnary' for type 'int' ((ref typeof(a) x) => ++x)(a); works

Re: manually call opUnary

2014-11-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 4/11/2014 8:19 p.m., Algo wrote: Is it possible? As in { int a; a.opUnary!"++"(); } no property 'opUnary' for type 'int' For primitives it doesn't look like it. To confirm this, we'll first figure out what TypeInfo is used for it: pragma(msg, typeid(int).name); /d133/f260.d(16)

manually call opUnary

2014-11-03 Thread Algo via Digitalmars-d-learn
Is it possible? As in { int a; a.opUnary!"++"(); } no property 'opUnary' for type 'int'