Question on Template Specializing.

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Tue Aug 6 22:59:42 PDT 2013


On Wednesday, 7 August 2013 at 05:31:07 UTC, evilrat wrote:
> On Wednesday, 7 August 2013 at 05:10:25 UTC, SteveGuo wrote:
>> The following example can't be compiled.
>>
>> // A.d
>> -------------------------------------
>>
>> class A(T)
>> {
>>    T a;
>> }
>>
>>
>> // main.d
>> -------------------------------------
>> import A;
>>
>> int main(string param[])
>> {
>>    A!(int) a;
>>
>>    return 0;
>> }
> doh... most of such weird errors are due to module naming. 
> module names should be always in lowercase(not neccessary but 
> recommended), and the second, your problem is due to name 
> conflict of module name and class name, just give your module a 
> meaningful name and problem is gone.

The name doesn't need to be changed, Instead main could have 
contain:

     A.A!(int) a;

Instantiate A from module A (instead of instantiate module A 
which is the cause of the error)


More information about the Digitalmars-d mailing list