[pooma-dev] Request for Review
Julian C. Cummings
cummings at linkline.com
Thu Apr 26 08:11:39 UTC 2001
Hi Scott,
I actually had written those templated constructor definitions
the way you suggest at first. I think that the "template <>"
should be there, indicating the specialization of the class
template. However, both the HP aCC compiler and (more
importantly) the Intel VTune compiler get confused by this.
This looks like a case where not all compilers have caught
up with the correct syntax. I think the best thing to do is what
John suggested: put the constructor definitions back inside
the class definition. That seems to work for all compilers
except aCC as far as I know, and there are a *lot* of other
problems with that compiler besides this one that are stopping
it from handling Pooma correctly.
Julian C.
-----Original Message-----
From: Scott Haney [mailto:scotth at proximation.com]
Sent: Wednesday, April 25, 2001 10:19 AM
To: pooma-dev at pooma.codesourcery.com
Subject: [pooma-dev] Request for Review
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 --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20010426/64ae630c/attachment.html>
More information about the pooma-dev
mailing list