mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Added move constructor for BonusList
This commit is contained in:
parent
55e27a6334
commit
d42947f109
@ -97,6 +97,13 @@ BonusList::BonusList(const BonusList &bonusList)
|
||||
belongsToTree = false;
|
||||
}
|
||||
|
||||
BonusList::BonusList(BonusList&& other):
|
||||
belongsToTree(false)
|
||||
{
|
||||
std::swap(belongsToTree, other.belongsToTree);
|
||||
std::swap(bonuses, other.bonuses);
|
||||
}
|
||||
|
||||
BonusList& BonusList::operator=(const BonusList &bonusList)
|
||||
{
|
||||
bonuses.resize(bonusList.size());
|
||||
@ -705,23 +712,16 @@ CBonusSystemNode::CBonusSystemNode() : bonuses(true), exportedBonuses(true), nod
|
||||
}
|
||||
|
||||
CBonusSystemNode::CBonusSystemNode(CBonusSystemNode && other):
|
||||
bonuses(other.bonuses),
|
||||
exportedBonuses(other.exportedBonuses),
|
||||
bonuses(std::move(other.bonuses)),
|
||||
exportedBonuses(std::move(other.exportedBonuses)),
|
||||
nodeType(other.nodeType),
|
||||
description(other.description),
|
||||
cachedLast(0)
|
||||
{
|
||||
//todo: move constructor for bonuslist
|
||||
other.bonuses.clear();
|
||||
other.exportedBonuses.clear();
|
||||
|
||||
bonuses.belongsToTree = true;
|
||||
exportedBonuses.belongsToTree = true;
|
||||
|
||||
std::swap(parents, other.parents);
|
||||
std::swap(children, other.children);
|
||||
|
||||
//TODO: move cache
|
||||
//cache ignored
|
||||
|
||||
//cachedBonuses
|
||||
//cachedRequests
|
||||
|
@ -423,6 +423,7 @@ public:
|
||||
|
||||
BonusList(bool BelongsToTree = false);
|
||||
BonusList(const BonusList &bonusList);
|
||||
BonusList(BonusList && other);
|
||||
BonusList& operator=(const BonusList &bonusList);
|
||||
|
||||
// wrapper functions of the STL vector container
|
||||
@ -494,8 +495,6 @@ public:
|
||||
{
|
||||
return bonuses.end();
|
||||
}
|
||||
|
||||
friend class CBonusSystemNode;
|
||||
};
|
||||
|
||||
// Extensions for BOOST_FOREACH to enable iterating of BonusList objects
|
||||
|
Loading…
Reference in New Issue
Block a user