Dimensions in compile time

Basile B. b2.temp at gmx.com
Mon Feb 8 13:17:46 UTC 2021


On Monday, 8 February 2021 at 13:13:33 UTC, Basile B. wrote:
> On Monday, 8 February 2021 at 13:09:53 UTC, Rumbu wrote:
>> On Monday, 8 February 2021 at 12:19:26 UTC, Basile B. wrote:
>>> [...]
>>
>> dimensionCount!string should be 2.
>>
>> My take without std.traits:
>>
>> template rank(T: U[], U)
>> {
>>    enum rank = 1 + rank!U;
>> }
>>
>> template rank(T: U[n], size_t n)
>> {
>>     enum rank = 1 + rank!U;
>> }
>>
>> template rank(T)
>> {
>>     enum rank = 0;
>> }
>
> yeah you're right, strings were a special case (I remember now) 
> so that stuff could be stored as literals.

well to OP just dont use my dimensionCount template ^^. it should 
have been declared with the "package" protection in first place; 
not public.


More information about the Digitalmars-d-learn mailing list