Is it possible to do this with a template?

Ali Çehreli acehreli at yahoo.com
Fri Dec 17 13:00:55 UTC 2021


On 12/17/21 1:57 AM, bauss wrote:

 > You can also do it as a normal template:
 >
 > ```d
 > template is_same(alias value, T)
 > {
 >      enum is_same = is(typeof(value) == T);
 > }
 > ```

And even shorter by realizing that it's an eponymous template:

enum is_same(alias value, T) = is(typeof(value) == T);

Ali



More information about the Digitalmars-d-learn mailing list