used make_shared and make_unique for creating shared pointers

This commit is contained in:
asapelkin
2019-10-24 09:50:31 +03:00
committed by wmayer
parent bbbabf99ae
commit f13a7627ae
3 changed files with 10 additions and 5 deletions

View File

@@ -46,6 +46,8 @@
#include <QAbstractEventDispatcher>
#include <deque>
#include <memory>
#include <unordered_set>
#include <Base/TimeInfo.h>
@@ -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();
@@ -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);
}
}

View File

@@ -26,6 +26,8 @@
#include <QVBoxLayout>
#endif
#include <memory>
#include <sstream>
#include <Base/Console.h>
@@ -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());
}

View File

@@ -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;
@@ -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));
}
}
}