Template with default parameter

bauss jj_1337 at live.dk
Fri Mar 11 11:59:54 UTC 2022


On Friday, 11 March 2022 at 11:55:24 UTC, Andrey Zherikov wrote:
> On Friday, 11 March 2022 at 07:06:15 UTC, bauss wrote:
>> Create an alias for T!() is the best you can do.
>>
>> Ex.
>>
>> ```
>> alias t = T!();
>> ```
>>
>> There isn't really any better method as far as I know.
>
> I'd like to preserve the name (`t` != `T`) but `alias T = T!()` 
> gives me `Error: declaration `T` is already defined`

Yeah you can't really do much about that.

Then T would have to be something like TImpl and then you do 
`alias T = TImpl!();`


More information about the Digitalmars-d-learn mailing list