What does this code snippet even do?
WhatMeWorry
kheaser at gmail.com
Fri Jan 29 22:41:33 UTC 2021
// The following four lines in run.lang.io
int[] a;
alias T = long;
pragma(msg, is(typeof(a) : U[], U : T));
pragma(msg, is(typeof(a) : T[]));
// returns
true
false
But I'm not even sure what I'm looking at. Ali's book talks
about the colon appearing for
:, associative array ⬁
:, import ⬁
:, inheritance ⬁
:, label
but I'm pretty sure none apply here.
I know about alias (T is replaced with long), pragma, is, and
typeof. But what is U and where does it come from? And what do
the colons do here?
More information about the Digitalmars-d-learn
mailing list