Hi
I have the following code defining a template class
template<class T>
class TemplateClass
{
public:
TemplateClass();
virtual ~TemplateClass() {}
private:
QMap<T,QString> m_strings;
};
template<class T> TemplateClass<T>::TemplateClass()
{
}
template<class T>
void TemplateClass<T>
::add (T key,
QString value
){
m_strings[key] = value;
}
template<class T>
void TemplateClass<T>
::getComboBoxStrings(QStringList &theStrings
) const{
QMap<T,QString>::iterator it;
template<class T>
class TemplateClass
{
public:
TemplateClass();
virtual ~TemplateClass() {}
void add (T key, QString value);
void get(QStringList &theStrings) const;
private:
QMap<T,QString> m_strings;
};
template<class T> TemplateClass<T>::TemplateClass()
{
}
template<class T> void TemplateClass<T>::add (T key, QString value)
{
m_strings[key] = value;
}
template<class T> void TemplateClass<T>::getComboBoxStrings(QStringList &theStrings) const
{
QMap<T,QString>::iterator it;
To copy to clipboard, switch view to plain text mode
When compiled I get the following error regarding the declaration of the iterator
MyClass.h: In member function 'void TemplateClass<T>::getComboBoxStrings(QStringList&) const':
MyClass.h:74: error: expected ';' before 'it'
MyClass.h: In member function 'void TemplateClass<T>::getComboBoxStrings(QStringList&) const':
MyClass.h:74: error: expected ';' before 'it'
To copy to clipboard, switch view to plain text mode
Could someone tell me why this is and error
Bookmarks