From d914b41a00d8956a7f625c85e119dec4096bb2a0 Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Sun, 31 Dec 2017 00:11:25 +0000 Subject: [PATCH 15/31] LinkGraph::NodeVector ~> std::vector --- src/linkgraph/linkgraph.cpp | 6 +++--- src/linkgraph/linkgraph.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/linkgraph/linkgraph.cpp b/src/linkgraph/linkgraph.cpp index 50945d361..2a4e28a4e 100644 --- a/src/linkgraph/linkgraph.cpp +++ b/src/linkgraph/linkgraph.cpp @@ -139,7 +139,7 @@ void LinkGraph::RemoveNode(NodeID id) node_edges[id] = node_edges[last_node]; } Station::Get(this->nodes[last_node].station)->goods[this->cargo].node = id; - this->nodes.Erase(this->nodes.Get(id)); + Erase(this->nodes, this->nodes.begin() + id); this->edges.EraseColumn(id); /* Not doing EraseRow here, as having the extra invalid row doesn't hurt * and removing it would trigger a lot of memmove. The data has already @@ -159,7 +159,7 @@ NodeID LinkGraph::AddNode(const Station *st) const GoodsEntry &good = st->goods[this->cargo]; NodeID new_node = this->Size(); - this->nodes.Append(); + Extend(this->nodes, 1); /* Avoid reducing the height of the matrix as that is expensive and we * most likely will increase it again later which is again expensive. */ this->edges.Resize(new_node + 1U, @@ -283,7 +283,7 @@ void LinkGraph::Init(uint size) { assert(this->Size() == 0); this->edges.Resize(size, size); - this->nodes.Resize(size); + this->nodes.resize(size); for (uint i = 0; i < size; ++i) { this->nodes[i].Init(); diff --git a/src/linkgraph/linkgraph.h b/src/linkgraph/linkgraph.h index 799f22c78..5220f81bb 100644 --- a/src/linkgraph/linkgraph.h +++ b/src/linkgraph/linkgraph.h @@ -435,7 +435,7 @@ public: void RemoveEdge(NodeID to); }; - typedef SmallVector NodeVector; + using NodeVector = std::vector; typedef SmallMatrix EdgeMatrix; /** Minimum effective distance for timeout calculation. */ @@ -496,7 +496,7 @@ public: * Get the current size of the component. * @return Size. */ - inline uint Size() const { return this->nodes.Length(); } + inline uint Size() const { return this->nodes.size(); } /** * Get date of last compression. -- 2.14.1