Here goes my code:
class PHPConstructIdentity::Impl{
private:
struct InternalImpl{
QStringList userClass;
QStringList systemClass;
QStringList phpClass;
QStringList userFunction;
QStringList systemFunction;
QStringList phpFunction;
QStringList userMacro;
QStringList systemMacro;
QStringList phpMacro;
};
InternalImpl* pImpl;
private:
class ConstructPointer{
private:
Construct c;
ConstructType t;
public:
ConstructPointer(Construct cns, ConstructType cnsT):c(cns), t(cnsT){}
bool operator==(const ConstructPointer& cnsPt) const{
return (cnsPt.c == c && cnsPt.t == t);
};
};
private:
QHash<ConstructPointer, QStringList*> constructList;
public:
Impl(){
constructList[ConstructPointer(Class, User)] = &pImpl->userClass;
constructList[ConstructPointer(Class, System)] = &pImpl->systemClass;
constructList[ConstructPointer(Class, PHP)] = &pImpl->phpClass;
constructList[ConstructPointer(Function, User)] = &pImpl->userFunction;
constructList[ConstructPointer(Function, System)] = &pImpl->systemFunction;
constructList[ConstructPointer(Function, PHP)] = &pImpl->phpFunction;
constructList[ConstructPointer(Macro, User)] = &pImpl->userMacro;
constructList[ConstructPointer(Macro, System)] = &pImpl->systemMacro;
constructList[ConstructPointer(Macro, PHP)] = &pImpl->phpMacro;
}
QStringList& construct(Construct cns, ConstructType cnsTp) const{
return *constructList[ConstructPointer(cns, cnsTp)];
}
};
and the following error is being fired:
compiling phpconstructidentity.cpp (g++)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:725: instantiated from 'T& QHash<Key, T>::operator[](const Key&) [with Key = PHPConstructIdentity::Impl::ConstructPointer, T = QStringList*]'
phpconstructidentity.cpp:38: instantiated from here
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:860: error: no matching function for call to 'qHash(const PHPConstructIdentity::Impl::ConstructPointer&)'
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:65: note: candidates are: uint qHash(char)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:66: note: uint qHash(uchar)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:67: note: uint qHash(signed char)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:68: note: uint qHash(ushort)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:69: note: uint qHash(short int)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:70: note: uint qHash(uint)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:71: note: uint qHash(int)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:72: note: uint qHash(ulong)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:80: note: uint qHash(long int)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:81: note: uint qHash(quint64)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:89: note: uint qHash(qint64)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:90: note: uint qHash(QChar)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:91: note: uint qHash(const QByteArray&)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:92: note: uint qHash(const QString&)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:93: note: uint qHash(const QStringRef&)
/usr/local/Trolltech/Qt-4.4.0/include/QtCore/qhash.h:94: note: uint qHash(const QBitArray&)
*** Exited with status: 2 ***