Re: Checking template parameter types of class

2015-05-25 Thread Ali Çehreli via Digitalmars-d-learn
On 05/24/2015 09:14 PM, tcak wrote: Line 243: auto fileResourceList = new shared FileResourceList( 2 ); main.d(243): Error: class main.FileResourceList(T) if (is(T : FileResource)) is used as a type struct and class templates do not have automatic type deduction; function templates do.

Re: Checking template parameter types of class

2015-05-25 Thread thedeemon via Digitalmars-d-learn
On Monday, 25 May 2015 at 04:15:00 UTC, tcak wrote: main.d(243): Error: class main.FileResourceList(T) if (is(T : FileResource)) is used as a type The error message is not indicating directly this, though logically it is still correct. Compiler means template is used as a type which is an

Re: Checking template parameter types of class

2015-05-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, May 25, 2015 03:42:22 tcak via Digitalmars-d-learn wrote: On Monday, 25 May 2015 at 03:35:22 UTC, Jonathan M Davis wrote: On Monday, May 25, 2015 03:19:29 tcak via Digitalmars-d-learn wrote: Is there any syntax for something like that: class Resource(T) if( is(T:

Re: Checking template parameter types of class

2015-05-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, May 25, 2015 03:19:29 tcak via Digitalmars-d-learn wrote: Is there any syntax for something like that: class Resource(T) if( is(T: FileResource) ){ } I tried it as above, but it is not accepted. Maybe I am following a wrong syntax. I tried class Resource(T: FileResource){ }

Re: Checking template parameter types of class

2015-05-24 Thread tcak via Digitalmars-d-learn
On Monday, 25 May 2015 at 03:35:22 UTC, Jonathan M Davis wrote: On Monday, May 25, 2015 03:19:29 tcak via Digitalmars-d-learn wrote: Is there any syntax for something like that: class Resource(T) if( is(T: FileResource) ){ } I tried it as above, but it is not accepted. Maybe I am following

Re: Checking template parameter types of class

2015-05-24 Thread tcak via Digitalmars-d-learn
On Monday, 25 May 2015 at 04:07:06 UTC, Jonathan M Davis wrote: On Monday, May 25, 2015 03:42:22 tcak via Digitalmars-d-learn wrote: Well, if I do not check the line number of error, this happens. It was giving error on the line of creating a new instance. Line 243: auto fileResourceList =

Checking template parameter types of class

2015-05-24 Thread tcak via Digitalmars-d-learn
Is there any syntax for something like that: class Resource(T) if( is(T: FileResource) ){ } I tried it as above, but it is not accepted. Maybe I am following a wrong syntax. I tried class Resource(T: FileResource){ } But it is not accepted as well.