compile-time detection of all pointer types in one test

Steven Schveighoffer schveiguy at gmail.com
Mon Jun 12 16:14:36 UTC 2023


On 6/11/23 5:25 PM, DLearner wrote:
> Is there any way of picking up, at compile-time, all pointer types in 
> one test?
> 

What you want is `is(T : void *)` but probably to also catch all 
constancy flavors, `is(immutable(T) : immutable(void*))`

When you use `==` in an `is` expression, it's asking is this *exactly* 
that type. Using the colon is asking can it *implicitly convert* to that 
type.

-Steve


More information about the Digitalmars-d-learn mailing list