Consider the 3 ways of constructing an object:
1)
LogTreeItem::LogTreeItem(const QList<QVariant>& data, LogTreeItem* parent) :
m_parentItem {parent}, m_itemData {data}
{
}
2)
LogTreeItem::LogTreeItem(const QList<QVariant>& data, LogTreeItem* parent) :
m_parentItem (parent), m_itemData (data)
{
}
3)
TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
{
m_parentItem = parent;
m_itemData = data;
}
Are they 100% equal? if not, where they differ? what are any advantage/disadvantage associated with each method?
I am guessing some stuff about copy assignment, move constructor or some advanced things in modern c++11 and beyond is getting done in case of 1 and 2.
Aucun commentaire:
Enregistrer un commentaire