shared and getParameterStorageClasses bug?
Timon Gehr
timon.gehr at gmx.ch
Mon Aug 24 21:12:01 UTC 2020
On 23.08.20 21:15, Andrei Alexandrescu wrote:
> On 8/23/20 10:21 AM, Paul Backus wrote:
>> On Sunday, 23 August 2020 at 14:11:21 UTC, Jean-Louis Leroy wrote:
>>>
>>> OK since the `shared` has migrated to the type, isSharedParameter can
>>> be written like this:
>>>
>>> enum isSharedParameter(alias fun, uint param) =
>>> is(Parameters!fun[param] == SharedOf!(Parameters!fun[param]));
>>
>> An even simpler way is to use the pattern-matching feature of `is(...)`:
>>
>> enum isSharedParameter(alias fun, size_t param) =
>> is(Parameters!fun[param] == shared(T), T);
>>
>> You can read this as, "there exists some T such that
>> Parameters!fun[param] is shared(T)".
>
> This would have problems if shared is combined with other qualifiers
> (const and my nemesis inout).
(Which is a compiler bug.)
More information about the Digitalmars-d
mailing list