Request for Review

Scott Haney scotth at proximation.com
Wed Apr 25 17:19:17 UTC 2001


I was looking at the changes that Julian made to Range, Interval, etc 
and, as reported by John, they indeed don't compile under Metrowerks. 
However, it seems like they shouldn't compile at all unless there is yet 
another corner case of C++. Here's the deal:

We have a class, which is a full specialization of a templated class:

template<class T> class Interval;

template<>
class Interval<1> {
   ...

   template<class T1, class T2>
   Interval(const T1 &m, const T2 &n);

};

The question is what does the definition of the constructor look like 
outside the class body. Julian had:

template<class T1, class T2>
Interval<1>::Interval(const T1, &m, const T2 &n) { ... }

Metrowerks complains of "Illegal function overloading" and I originally 
just thought this was a bug, but on further thought, it looks like the 
function should read:

template<>
template<class T1, class T2>
Interval<1>::Interval(const T1, &m, const T2 &n) { ... }

This compiles with CodeWarrior and it makes sense to me, but is this 
correct? If so, I'll check in the changes, which consist of adding the 
template<> on the top of the 6 out of line ctors at the bottom of 
Interval.h, Grid.h, and Range.h.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1222 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20010425/9bba7712/attachment.bin>


More information about the pooma-dev mailing list