# HG changeset patch # User Stefan BrĂ¼ns # Date 1409693839 -7200 # Tue Sep 02 23:37:19 2014 +0200 # Node ID 3d486512d9b5cd36d800f5668a53e8d19df90de9 # Parent 84ce7596125ceefe567055efd3ee195285fa38ff Use stack-allocated CheckpointPixels instead of unique_ptr tracked one. No need to allocate it on the heap. diff -r 84ce7596125c -r 3d486512d9b5 src/graphcut.h --- a/src/graphcut.h Tue Sep 02 23:34:06 2014 +0200 +++ b/src/graphcut.h Tue Sep 02 23:37:19 2014 +0200 @@ -1335,7 +1335,7 @@ std::vector* dualPath = nullptr; std::vector totalDualPath; vigra::Point2D intermediatePoint; - std::unique_ptr srcDestPoints(new CheckpointPixels()); + CheckpointPixels srcDestPoints; const vigra::Diff2D graphsize(graphImg.lowerRight().x - graphImg.upperLeft().x, graphImg.lowerRight().y - graphImg.upperLeft().y); @@ -1444,9 +1444,9 @@ continue; } - srcDestPoints->clear(); - srcDestPoints->top.insert(intermediatePoint); - srcDestPoints->bottom.insert(*i); + srcDestPoints.clear(); + srcDestPoints.top.insert(intermediatePoint); + srcDestPoints.bottom.insert(*i); #ifdef DEBUG_GRAPHCUT std::cout << "Running graph-cut: " << intermediatePoint << ":" << *i << std::endl; @@ -1454,7 +1454,7 @@ dualPath = A_star, IMAGETYPE, BasePixelType> (vigra::Point2D(-10, -10), vigra::Point2D(-20, -20), &intermediateGraphImg, &gradientX, - &gradientY, graphsize - vigra::Diff2D(1, 1), srcDestPoints.get(), &visited); + &gradientY, graphsize - vigra::Diff2D(1, 1), &srcDestPoints, &visited); visited.insert(dualPath->begin(), dualPath->end());