TypeFunction example: ImplictConvTargets
Stefan Koch
uplink.coder at googlemail.com
Mon Oct 5 23:47:10 UTC 2020
On Monday, 5 October 2020 at 22:53:31 UTC, Meta wrote:
>
> type[] basicTypeConvTargets(type T)
> {
> assert(isBasicType(T), "You may not call this function when
> you don't have a basic type ... (given: " ~ T.stringof ~ ")");
> return basic_types.filter!((alias U) => is(T: U)).array;
> }
>
> Yes, it instantiates a few templates, but it also demonstrates
> that working with type-values is as easy as working with
> regular values.
That should work actually.
as long as you include "alias type = alias;"
which gives you the type type.
And then you can write
basic_types.filter!((type U) => is(T: U)).array;
If that doesn't work, I am going to fix it shortly.
More information about the Digitalmars-d
mailing list