From fe2d53e880b84e76b8e6e8ed7193ad29ce67c651 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Fri, 1 Feb 2019 17:35:55 +0100 Subject: [PATCH] replace deprecated std::auto_ptr with std::unique_ptr --- modules/gfx/pymod/export_gradient.cc | 4 ++-- modules/gui/pymod/export_perspective.cc | 3 +-- modules/mol/base/src/impl/query_impl.cc | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/gfx/pymod/export_gradient.cc b/modules/gfx/pymod/export_gradient.cc index 03eeb5401..fa09e623b 100644 --- a/modules/gfx/pymod/export_gradient.cc +++ b/modules/gfx/pymod/export_gradient.cc @@ -33,7 +33,7 @@ using namespace ost::gfx; namespace { Gradient* make_gradient_d(const dict& d) { - std::auto_ptr<Gradient> grad(new Gradient); + std::unique_ptr<Gradient> grad(new Gradient); list keys = d.keys(); for(int i=0;i<len(keys);++i) { extract<float> fex(keys[i]); @@ -65,7 +65,7 @@ namespace { Gradient* make_gradient_l(const list& l) { - std::auto_ptr<Gradient> grad(new Gradient); + std::unique_ptr<Gradient> grad(new Gradient); float mf = len(l)<2 ? 0.0 : 1.0/static_cast<float>(len(l)-1); for(int i=0;i<len(l);++i) { float mark = static_cast<float>(i)*mf; diff --git a/modules/gui/pymod/export_perspective.cc b/modules/gui/pymod/export_perspective.cc index 720ef3200..fbc5b6c59 100644 --- a/modules/gui/pymod/export_perspective.cc +++ b/modules/gui/pymod/export_perspective.cc @@ -45,8 +45,7 @@ object app_get_menu(Perspective* pers, const QString& name) void export_Perspective() { - class_<Perspective, std::auto_ptr<Perspective>, - boost::noncopyable>("Perspective", no_init) + class_<Perspective, boost::noncopyable>("Perspective", no_init) .def("GetPanels", &Perspective::GetPanels, return_value_policy<reference_existing_object>()) .def("GetMainArea", &Perspective::GetMainArea, diff --git a/modules/mol/base/src/impl/query_impl.cc b/modules/mol/base/src/impl/query_impl.cc index 849b2977a..3e267c5c4 100644 --- a/modules/mol/base/src/impl/query_impl.cc +++ b/modules/mol/base/src/impl/query_impl.cc @@ -743,7 +743,7 @@ Node* QueryImpl::ParsePropValueExpr(QueryLexer& lexer) { return NULL; } } - std::auto_ptr<Node> root_value(NULL); + std::unique_ptr<Node> root_value; do { Node* sel_node=this->ParseValueOrRange(property, op, lexer); if (sel_node==NULL) { @@ -814,10 +814,10 @@ Node* QueryImpl::ParseBracketSubExpr(QueryLexer& lexer) { } Node* QueryImpl::ParseSubExpr(QueryLexer& lexer, bool paren) { - // Use auto_ptr to protect against memory leaks. In case of early exit, i.e. + // Use unique_ptr to protect against memory leaks. In case of early exit, i.e. // exceptions, the memory associated with root_node and its child nodes will // be freed. - std::auto_ptr<Node> root_node(NULL); + std::unique_ptr<Node> root_node; Node* new_node=NULL; QueryToken t=lexer.CurrentToken(); LogicOP logic_op=LOP_AND; -- GitLab