Fastest way to check using if identifier has already been defined, using static if or similar?

Stefan Koch uplink.coder at googlemail.com
Wed Jun 3 16:22:31 UTC 2020


On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote:
> On Wednesday, 3 June 2020 at 09:03:22 UTC, drathier wrote:
>> [...]
>
> You can use this template:
>
>   enum Exists(alias T) = is(typeof(T));
>
> I don't know if there's a faster way bu this technic is used, 
> notatbly in phobos, to workaroud issues of double declaration 
> in `static foreach`

Please don't promote templates like this as long as they are not 
really zero-cost.
They don't add much to compile time granted.
But Barnacles.



More information about the Digitalmars-d-learn mailing list