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 13:37:26 UTC 2023


On 11.03.23 14:22, rempas wrote:
> On Saturday, 11 March 2023 at 12:59:59 UTC, ag0aep6g wrote:
>>
>> 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));
> 
> Wait, but "Foo" is defined twice and it doesn't let me compile...

You're doing something wrong then.

Don't put the Foo declarations in a function or unittest.


More information about the Digitalmars-d-learn mailing list