PanelItem is a class that does not have copy constructor(=Deleted). I use QList<PanelItem> m_arrPanelItems to store them.
When I call QList::append(const T &value), an error 'PanelItem::PanelItem(const PanelItem &)': attempting to reference a deleted function occur. I think it calls PanelItem::PanelItem(const PanelItem &) inside the function.
When I use range-for, the error appeared again. I use the const auto& in range_declaration. So I think the copy constructor PanelItem::PanelItem(const PanelItem &) will not be used.
// QList<PanelItem> m_arrPanelItems
for (const auto& t_item : this->m_arrpPanelItems) {
    // do something 
}
Why?
Aucun commentaire:
Enregistrer un commentaire