how do I tell if something is lvalue?
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 1 11:56:42 PST 2016
On 2/1/16 2:47 PM, Meta wrote:
> On Monday, 1 February 2016 at 18:28:05 UTC, Artur Skawina wrote:
>> On 01/31/16 23:11, Steven Schveighoffer via Digitalmars-d-learn wrote:
>>> Thanks! I was surprised this is not straightforward.
>>
>> enum isLvalue(alias A) = is(typeof((ref _){}(A)));
>>
>> artur
>
> That looks much nicer. It still needs work to properly handle functions
> with non-empty argument lists. Also, can alias parameters take runtime
> variables? I can't remember.
>
> struct S
> {
> int w(int n) { return 1; }
> }
>
> static assert(isLvalue!(S.w));
Nice for the general case, but in my case, I don't need to worry about
parameters.
Thanks!
-Steve
More information about the Digitalmars-d-learn
mailing list