shared and getParameterStorageClasses bug?

Paul Backus snarwin at gmail.com
Sun Aug 23 14:21:19 UTC 2020


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)".


More information about the Digitalmars-d mailing list