How can I get the scalar type of a pointer to pointer (and in even deeper levels)

ag0aep6g anonymous at example.com
Sat Mar 11 12:59:59 UTC 2023


On 11.03.23 13:49, rempas wrote:
> but what 
> about pointers to pointers like: `int****`? Is there a way that I would 
> be able to always get the scalar type of a pointer regardless of how 
> many levels it is? As always, I'm searching for a solution that will 
> work in `BetterC`.

alias Foo(T : U*, U) = Foo!U;
alias Foo(T) = T;
static assert(is(Foo!(int*) == int));
static assert(is(Foo!(int**) == int));
static assert(is(Foo!(int***) == int));
static assert(is(Foo!(int****) == int));


More information about the Digitalmars-d-learn mailing list