replace deprecated auto_ptr with unique_ptr
This commit is contained in:
@@ -52,12 +52,12 @@ int PointsPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
{
|
||||
PyObject *pcObj=0;
|
||||
if (!PyArg_ParseTuple(args, "|O", &pcObj)) // convert args: Python->C
|
||||
return -1; // NULL triggers exception
|
||||
|
||||
// if no mesh is given
|
||||
return -1; // NULL triggers exception
|
||||
|
||||
// if no mesh is given
|
||||
if (!pcObj) return 0;
|
||||
if (PyObject_TypeCheck(pcObj, &(PointsPy::Type))) {
|
||||
*getPointKernelPtr() = *(static_cast<PointsPy*>(pcObj)->getPointKernelPtr());
|
||||
*getPointKernelPtr() = *(static_cast<PointsPy*>(pcObj)->getPointKernelPtr());
|
||||
}
|
||||
else if (PyList_Check(pcObj)) {
|
||||
if (!addPoints(args))
|
||||
@@ -82,11 +82,11 @@ PyObject* PointsPy::copy(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
|
||||
PointKernel* kernel = new PointKernel();
|
||||
// assign data
|
||||
*kernel = *getPointKernelPtr();
|
||||
return new PointsPy(kernel);
|
||||
|
||||
PointKernel* kernel = new PointKernel();
|
||||
// assign data
|
||||
*kernel = *getPointKernelPtr();
|
||||
return new PointsPy(kernel);
|
||||
}
|
||||
|
||||
PyObject* PointsPy::read(PyObject * args)
|
||||
@@ -178,7 +178,7 @@ PyObject* PointsPy::fromSegment(PyObject * args)
|
||||
try {
|
||||
const PointKernel* points = getPointKernelPtr();
|
||||
Py::Sequence list(obj);
|
||||
std::auto_ptr<PointKernel> pts(new PointKernel());
|
||||
std::unique_ptr<PointKernel> pts(new PointKernel());
|
||||
pts->reserve(list.size());
|
||||
int numPoints = static_cast<int>(points->size());
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
@@ -202,7 +202,7 @@ PyObject* PointsPy::fromValid(PyObject * args)
|
||||
|
||||
try {
|
||||
const PointKernel* points = getPointKernelPtr();
|
||||
std::auto_ptr<PointKernel> pts(new PointKernel());
|
||||
std::unique_ptr<PointKernel> pts(new PointKernel());
|
||||
pts->reserve(points->size());
|
||||
for (PointKernel::const_iterator it = points->begin(); it != points->end(); ++it) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z))
|
||||
|
||||
Reference in New Issue
Block a user