qt - QHash cannot convert parameter 1 from 'class QHash<class QDomElement,class QDomElement>::const_iterator' to '::iterator' -
i have qhash defined key value pair qdomelement. given below. trying update hash using const_iterator. while doing below error thrown, how resolve same:-
error c2664: 'erase' : cannot convert parameter 1 'class qhash<class qdomelement,class qdomelement>::const_iterator' 'class qhash<class qdomelement,class qdomelemen t>::iterator' code snippet :-
// update parent child mapping hash qhash<qdomelement, qdomelement>::const_iterator plist = hashparentchildlist.constbegin(); while (plist != hashparentchildlist.constend()) { if(plist.key() == element) { plist = hashparentchildlist.erase(plist); // error line } else { plist++; } } } thanks, priyanka
problem solved, use qhash::iterator plist = hashparentchildlist.begin(); instead of qhash::const_iterator plist = hashparentchildlist.constbegin();
Comments
Post a Comment