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. The solution is to provide a convenience function template alongside the struct or class.

> auto fileResourceList = new shared FileResourceList!FileResource( 2 );
>
> Then it works. The error message is not indicating directly this, though
> logically it is still correct.

'if (is(T : FileResource))' part means "if T can implicitly be converted to FileResource". You still provide T so that it gets checked.

Ali

Reply via email to