nlgonsal
May 28th, 2002, 03:10 PM
This was my template problem in Borland C++ Builder 5.0. I have a template class called HPoint_nD<class T, class D>. I also have another template class called Basic2DArray<class T>. The Basic2DArray has a friend function called initBasic2DArray(Basic2DArray<class T>& , const int, const int). Now this function is only overloaded (or in the template case - explicit specialization) when the Basic2DArray parameter passed to it is HPoint_nD<T,D>. In the overloading, another function called initBasic2DArrayHpoint(Basic2DArray<class T>& , const int, const int) is called, where the HPoint_nD template class parameter is handled differently. Now the HPoint_nD template class has only 4 classes which are actually used. These are HPoint_nD<float,2>, HPoint_nD<float,3>, HPoint_nD<double,2>, HPoint_nD<double,3>. The only time I do not get a linker error when I try to use the Basic2DArray<Hpoint_nD<T,D> > is when the HPoint_nD<double,2> is used. All the other ones result in the linker error, "Unresolved external error with void initBasic2DArrayHpoint(Basic2DArray<class T>& , const int, const int)." The class definitions for the 4 HPoint_nD classes are similar and the explicit instantiations are also similar. Why do you think this is happenning ? Is it just Borland acting weird ? Or is there something about template instatiation and explicit specialization I am not doing ? If you need the files to look at, I will send them.
Thanks
Regards
Nitin
Thanks
Regards
Nitin