Re: GCC 3.3 template compile error?
Re: GCC 3.3 template compile error?
- Subject: Re: GCC 3.3 template compile error?
- From: David Fang <email@hidden>
- Date: Sat, 20 Oct 2007 21:19:33 -0400 (EDT)
What am I doing wrong here?
template <class T>
class LevelValueScaleTable
{
private:
T m_initialValue;
std::vector<T> m_scaleTable;
mutable T m_cachedValue;
mutable int m_cachedScale;
public:
LevelValueScaleTable() : m_initialValue(0), m_cachedScale(-1) {}
void Read(const LibXmlReader& reader, const xmlpp::Node* node)
{
m_scaleTable.clear();
m_initialValue = reader.getAttribute<T>(node, "initial"); // <--
error occurs here
...
------------------------------------------------------------------------
I have sometimes gotten this error when a name was not recognized, but I
don't see that kind of problem here.
Are the arguments to getAttribute correct for type and constness? Do the
parameters they correspond to depend on the template parameter for
getAttribute?
Hi,
Sorry if this reply comes late, but I haven't been checking this
list as regularly as before.
On your error line, you need:
m_initialValue = reader.template getAttribute<T>(node, "initial");
^^^^^^^^
The 'template' keyword is a disambiguator when calling template member
functions within a template context. Adding 'template' will make your
code happy with gcc-3.3 through gcc-4 (and beyond).
Better late than never? :)
Fang
David Fang
Computer Systems Laboratory
Electrical & Computer Engineering
Cornell University
http://www.csl.cornell.edu/~fang/
-- (2400 baud? Netscape 3.0?? lynx??? No problem!)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden