modernize C++: make unique
This commit is contained in:
@@ -1036,7 +1036,7 @@ void LinkView::setLinkViewObject(ViewProviderDocumentObject *vpd,
|
||||
auto it = subInfo.find(subname);
|
||||
if(it == subInfo.end()) {
|
||||
it = subInfo.insert(std::make_pair(subname,std::unique_ptr<SubInfo>())).first;
|
||||
it->second.reset(new SubInfo(*this));
|
||||
it->second = std::make_unique<SubInfo>(*this);
|
||||
}
|
||||
if(subelement[0])
|
||||
it->second->subElements.insert(subelement);
|
||||
@@ -1077,7 +1077,7 @@ void LinkView::setSize(int _size) {
|
||||
pcLinkRoot->addChild(info->pcSwitch);
|
||||
|
||||
while(nodeArray.size()<size) {
|
||||
nodeArray.push_back(std::unique_ptr<Element>(new Element(*this)));
|
||||
nodeArray.push_back(std::make_unique<Element>(*this));
|
||||
auto &info = *nodeArray.back();
|
||||
info.pcRoot->addChild(info.pcTransform);
|
||||
if(pcLinkedRoot)
|
||||
@@ -1129,8 +1129,9 @@ void LinkView::setChildren(const std::vector<App::DocumentObject*> &children,
|
||||
std::map<App::DocumentObject*, size_t> groups;
|
||||
for(size_t i=0;i<children.size();++i) {
|
||||
auto obj = children[i];
|
||||
if(nodeArray.size()<=i)
|
||||
nodeArray.push_back(std::unique_ptr<Element>(new Element(*this)));
|
||||
if(nodeArray.size()<=i) {
|
||||
nodeArray.push_back(std::make_unique<Element>(*this));
|
||||
}
|
||||
auto &info = *nodeArray[i];
|
||||
info.isGroup = false;
|
||||
info.groupIndex = -1;
|
||||
@@ -2633,7 +2634,7 @@ bool ViewProviderLink::initDraggingPlacement() {
|
||||
FC_ERR("initDraggingPlacement() expects return of type tuple(matrix,placement,boundbox)");
|
||||
return false;
|
||||
}
|
||||
dragCtx.reset(new DraggerContext);
|
||||
dragCtx = std::make_unique<DraggerContext>();
|
||||
dragCtx->initialPlacement = *static_cast<Base::PlacementPy*>(pypla)->getPlacementPtr();
|
||||
dragCtx->preTransform = *static_cast<Base::MatrixPy*>(pymat)->getMatrixPtr();
|
||||
dragCtx->bbox = *static_cast<Base::BoundBoxPy*>(pybbox)->getBoundBoxPtr();
|
||||
@@ -2663,7 +2664,7 @@ bool ViewProviderLink::initDraggingPlacement() {
|
||||
return false;
|
||||
}
|
||||
|
||||
dragCtx.reset(new DraggerContext);
|
||||
dragCtx = std::make_unique<DraggerContext>();
|
||||
|
||||
dragCtx->preTransform = doc->getEditingTransform();
|
||||
doc->setEditingTransform(dragCtx->preTransform);
|
||||
|
||||
Reference in New Issue
Block a user