On Sunday, 11 June 2023 at 21:32:11 UTC, Andy wrote:
[...]
void main() {
import std.stdio;
struct foo {}
foo* fooptr;
static if (is(typeof(fooptr) == T*, T))
writeln("fooptr is a pointer to a ", T.stringof);
else
writeln(
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
Just to be clear where the argument goes (from templates parameters ext.):
``is(InputType : T*, T)``
std.traits : isPointer
or
``is(int* : T*, T)``
On Sunday, 11 June 2023 at 21:25:21 UTC, DLearner wrote:
Please consider:
```
void main() {
import std.stdio;
struct foo {
int foo1;
char foo2;
}
foo* fooptr;
void* genptr;
static if (is(typeof(fooptr) == void*))
writeln("fooptr is void*");
Please consider:
```
void main() {
import std.stdio;
struct foo {
int foo1;
char foo2;
}
foo* fooptr;
void* genptr;
static if (is(typeof(fooptr) == void*))
writeln("fooptr is void*");
else
writeln("fooptr is not void*");