Is it possible to do this with a template?
rempas
rempas at tutanota.com
Fri Dec 17 21:40:02 UTC 2021
On Friday, 17 December 2021 at 13:00:55 UTC, Ali Çehreli wrote:
> 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
Thanks guys! Yeah, I prefer Ali's shorter syntax!
More information about the Digitalmars-d-learn
mailing list