Deduction of Template Value Parameters

Steven Schveighoffer schveiguy at yahoo.com
Wed Nov 3 07:38:39 PDT 2010


On Wed, 03 Nov 2010 10:19:28 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Tue, 02 Nov 2010 21:56:44 -0400, gg <noreply at now.pl> wrote:
>
>> Why we cant deduce value parameter of templates:
>> void caracterize(uint m)(pp!(m)){
>> 	
>> }
>> class pp(uint m){
>>
>> }
>> void main(){
>> 	caracterize(pp!5);
>> }
>> fails with
>>
>> dmd chap.d
>> chap.d(8): Error: template chap.caracterize(uint m) does not match any  
>> function template declaration
>> chap.d(8): Error: template chap.caracterize(uint m) cannot deduce  
>> template function from argument types !()(void)
>>
>> Or at least of a way to extract template instantiation information  
>> would be useful. Or  it is needed to do it the long way
>
> I think there is a way to do this, but I think you have to include the  
> pp!(m) parameter, something like:
>
> caracterize(m, T : pp!m)(pp!(m) arg)

Hm... that should have been:

caracterize(m, T : pp!m)(T arg)

-Steve


More information about the Digitalmars-d mailing list