Deducing types for function templates

Simen kjaeraas simen.kjaras at gmail.com
Tue Mar 15 10:20:30 PDT 2011


On Tue, 15 Mar 2011 17:36:04 +0100, Michel Fortin  
<michel.fortin at michelf.com> wrote:

> On 2011-03-15 10:42:46 -0400, Magnus Lie Hetland <magnus at hetland.org>  
> said:
>
>> I've got a function template along these lines:
>>    Foo!T foo(T)(T[] bar, real function(T,T) baz) { ... }
>>  The main reason I'm using this is that it seems necessary to use a  
>> function, rather than a type (such as Foo), if you want the compiler to  
>> deduce the compile-time parameters. (Right?)
>>  Now ... this works just fine. However, if I try to add "const" before  
>> "T[]", DMD no longer groks it. Is that how it shold be? Seems awkward  
>> to me... (Or maybe I'm just doing it wrong?)
>
> I'd say add it to bugzilla. It's probably related to this bug:
> <http://d.puremagic.com/issues/show_bug.cgi?id=5531>

Oh, it's much older than that:

http://d.puremagic.com/issues/show_bug.cgi?id=2128

-- 
Simen


More information about the Digitalmars-d-learn mailing list