__has_side_effects
Nicholas Wilson
iamthewilsonator at hotmail.com
Sun Apr 1 04:30:03 UTC 2018
On Sunday, 1 April 2018 at 04:11:37 UTC, Uknown wrote:
> On Friday, 30 March 2018 at 20:28:27 UTC, Andrei Alexandrescu
> wrote:
>> https://www.reddit.com/r/programming/comments/88aqsf/the_joy_of_max/
>>
>> Discussion aside, I notice with pleasant surprise gcc has an
>> introspection primitive we didn't think of: __is_constant that
>> (I assume) yields true if the given expression has no side
>> effects.
>>
>> In D the primitive would be called e.g. __has_side_effects to
>> avoid confusion with the "const" qualifier.
>>
>> I wonder how difficult it would be to define
>> __has_side_effects (it would apply to an alias) and how it can
>> be put to good use.
>>
>>
>> Andrei
>
> Just for the fun of it, I implemented this as a template:
>
> https://run.dlang.io/is/pXLndG
You're missing classes, AAs, and pointers (possibly function
pointers and delegates as well).
More information about the Digitalmars-d
mailing list