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

rempas rempas at tutanota.com
Sat Mar 11 13:55:47 UTC 2023


On Saturday, 11 March 2023 at 13:37:26 UTC, ag0aep6g wrote:
> 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.

Oh, so it tries to re-define them if I put them inside a 
function! Thank you brother, works great! Have a great day!


More information about the Digitalmars-d-learn mailing list