freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Request for Review


From: Scott Haney
Subject: Request for Review
Date: Wed, 25 Apr 2001 11:19:17 -0600

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]