Fastest way to check using if identifier has already been defined, using static if or similar?
Simen Kjærås
simen.kjaras at gmail.com
Wed Jun 3 10:24:44 UTC 2020
On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. 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`
enum Exists(alias T) = is(typeof(T));
static assert(!Exists!bar); // undefined identifier bar
--
Simen
More information about the Digitalmars-d-learn
mailing list