shared and getParameterStorageClasses bug?
schveiguy at gmail.com
Sun Aug 23 14:38:34 UTC 2020
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)".
is(Parameters!fun[param] == shared);
This works for all type constructors.
I think there's no way to get this as a nice string list though like a
__traits might do (though it could be done).
More information about the Digitalmars-d