the best language I have ever met(?)

Igor Shirkalin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 25 06:27:39 PST 2016


On Wednesday, 23 November 2016 at 18:58:55 UTC, ketmar wrote:
>> We can define static array without counting the elements as 
>> following:
>>
>>
>> enum array_ = [1u,2,3,4];
>> uint[array_.length] static_array = array_;
>
> there are workarounds, of course. yet i'll take mine `uint[$] a 
> = [1u,2,3,4];` over that quoted mess at any time, without 
> second thought. ;-)

I think you may write it (I mean actual D) with using some 
template like this:

auto array = static_array!uint(1, 2, 3, 4)

Could you please help to write down this template in the best and 
clear manner?


More information about the Digitalmars-d-learn mailing list