DMD 1.031 and 2.015 templates
Lars Ivar Igesund
larsivar at igesund.net
Thu Jun 19 02:25:18 PDT 2008
Walter Bright wrote:
> Lars Ivar Igesund wrote:
>> Walter Bright wrote:
>>
>>> Some new stuff to make writing templates easier.
>>>
>>> http://www.digitalmars.com/d/1.0/changelog.html
>>> http://ftp.digitalmars.com/dmd.1.030.zip
>>
>> (Wrong zip link ^)
>>
>> Something broke, probably due to the fix in 617 and/or 1383:
>>
>> Given
>>
>> T[] layout(T) (T[] output, T[][] layout ...)
>>
>> the following code
>>
>> T[] format(T) (T[] output, Time t) {
>>
>> T[] convert (T[] tmp, long i)
>> {
>> return Integer.formatter!(T) (tmp, i, 'u', 0, 8);
>> }
>>
>> return layout (output, "%0, %1 %2 %3 %4:%5:%6 GMT",
>> Days[date.dow],
>> convert (tmp[0..2], date.day),
>> Months[date.month-1],
>> convert (tmp[2..6], date.year),
>> convert (tmp[6..8], time.hours),
>> convert (tmp[8..10], time.minutes),
>> convert (tmp[10..12], time.seconds)
>> );
>> }
>>
>> results in
>>
>> :template layout(T) does not match any template declaration
>> :template layout(T) cannot deduce template function from argument types
>>
(wchar[],char[25u],wchar[],wchar[],wchar[],wchar[],wchar[],wchar[],wchar[])
>
> Can you make a standalone test case, please?
The standalone test case works fine if I append 'w' to the literal, so seems
like that is a no :) However, prepending it with cast(T[]) seems to be an
acceptable workaround though.
--
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
More information about the Digitalmars-d-announce
mailing list