Azathoth42

memory leak

Nov 9th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. std::vector<std::shared_ptr<App::Node>> AStar::findPath(std::vector<std::shared_ptr<App::Node>> nodes, std::shared_ptr<App::Node> start, std::shared_ptr<App::Node> end)
  2.     {
  3.         std::shared_ptr<NodeWrapper> current;
  4.         current = std::make_shared<NodeWrapper>(nullptr, start, end);
  5.         //jádro algoritmu, celé zakomentované
  6.         //...
  7.         std::vector<std::shared_ptr<NodeWrapper>> way = current->getWay();
  8.  
  9. //      hydrating path from node wrappers
  10.         auto path = std::vector<std::shared_ptr<App::Node>>(way.size());
  11.         for (size_t i = 0; i < way.size(); i++)
  12.         {
  13.             path[i] = way[i]->getNode();
  14.         }
  15.  
  16.         return path;
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment