Skip to content

Commit

Permalink
used make_shared and make_unique for creating shared pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
asapelkin authored and wwmayer committed Nov 21, 2019
1 parent bbbabf9 commit f13a762
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/Gui/DAGView/DAGModel.cpp
Expand Up @@ -46,6 +46,8 @@
#include <QAbstractEventDispatcher>

#include <deque>
#include <memory>

#include <unordered_set>

#include <Base/TimeInfo.h>
Expand Down Expand Up @@ -105,8 +107,8 @@ Model::Model(QObject *parentIn, const Gui::Document &documentIn) : QGraphicsScen
//underneath cursor.
this->setItemIndexMethod(QGraphicsScene::NoIndex);

theGraph = std::shared_ptr<Graph>(new Graph());
graphLink = std::shared_ptr<GraphLinkContainer>(new GraphLinkContainer());
theGraph = std::make_shared<Graph>();
graphLink = std::make_shared<GraphLinkContainer>();
setupViewConstants();
setupFilters();

Expand Down Expand Up @@ -488,7 +490,7 @@ void Model::updateSlot()
boost::tie(edge, result) = boost::add_edge(currentVertex, otherVertex, *theGraph);
if (result)
{
(*theGraph)[edge].connector = std::shared_ptr<QGraphicsPathItem>(new QGraphicsPathItem());
(*theGraph)[edge].connector = std::make_shared<QGraphicsPathItem>();
(*theGraph)[edge].connector->setZValue(0.0);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/Gui/DAGView/DAGView.cpp
Expand Up @@ -26,6 +26,8 @@
#include <QVBoxLayout>
#endif

#include <memory>

#include <sstream>

#include <Base/Console.h>
Expand Down Expand Up @@ -70,7 +72,7 @@ void View::slotActiveDocument(const Document &documentIn)
ModelMap::const_iterator it = modelMap.find(&documentIn);
if (it == modelMap.end())
{
ModelMap::value_type entry(std::make_pair(&documentIn, std::shared_ptr<Model>(new Model(this, documentIn))));
ModelMap::value_type entry(std::make_pair(&documentIn, std::make_shared<Model>(this, documentIn)));
modelMap.insert(entry);
this->setScene(entry.second.get());
}
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/Path/libarea/AreaOrderer.cpp
Expand Up @@ -28,6 +28,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


#include "AreaOrderer.h"
#include <memory>
#include "Area.h"

using namespace std;
Expand Down Expand Up @@ -132,7 +133,7 @@ void CInnerCurves::Unite(shared_ptr<CInnerCurves> c)
else
{
if(curve.IsClockwise())curve.Reverse();
Insert(shared_ptr<CCurve>(new CCurve(curve)));
Insert(std::make_shared<CCurve>(curve));
}
}
}
Expand Down

0 comments on commit f13a762

Please sign in to comment.