diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-05-17 23:31:44 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-05-21 20:02:34 +0200 |
commit | f2b40f40aa7cbccaed20ec52b41d4704a45d8db1 (patch) | |
tree | 2f8268a7292118c9e460524a139ab85766ed3425 /src/linkgraph | |
parent | 7309bdec48c70499301eb579991c2db6f7ef1d99 (diff) | |
download | openttd-f2b40f40aa7cbccaed20ec52b41d4704a45d8db1.tar.xz |
Codechange: Replace SmallPair with std::pair.
std::pair is already the smallest possible pair, and it already handles non-POD types correctly.
Diffstat (limited to 'src/linkgraph')
-rw-r--r-- | src/linkgraph/linkgraph.h | 11 | ||||
-rw-r--r-- | src/linkgraph/linkgraphjob.h | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/linkgraph/linkgraph.h b/src/linkgraph/linkgraph.h index 997d94623..7362b7d56 100644 --- a/src/linkgraph/linkgraph.h +++ b/src/linkgraph/linkgraph.h @@ -17,6 +17,7 @@ #include "../cargotype.h" #include "../date_func.h" #include "linkgraph_type.h" +#include <utility> struct SaveLoad; class LinkGraph; @@ -188,20 +189,20 @@ public: * to return something that implements operator->, but isn't a pointer * from operator->. A fake pointer. */ - class FakePointer : public SmallPair<NodeID, Tedge_wrapper> { + class FakePointer : public std::pair<NodeID, Tedge_wrapper> { public: /** * Construct a fake pointer from a pair of NodeID and edge. * @param pair Pair to be "pointed" to (in fact shallow-copied). */ - FakePointer(const SmallPair<NodeID, Tedge_wrapper> &pair) : SmallPair<NodeID, Tedge_wrapper>(pair) {} + FakePointer(const std::pair<NodeID, Tedge_wrapper> &pair) : std::pair<NodeID, Tedge_wrapper>(pair) {} /** * Retrieve the pair by operator->. * @return Pair being "pointed" to. */ - SmallPair<NodeID, Tedge_wrapper> *operator->() { return this; } + std::pair<NodeID, Tedge_wrapper> *operator->() { return this; } }; public: @@ -266,9 +267,9 @@ public: * Dereference with operator*. * @return Pair of current target NodeID and edge object. */ - SmallPair<NodeID, Tedge_wrapper> operator*() const + std::pair<NodeID, Tedge_wrapper> operator*() const { - return SmallPair<NodeID, Tedge_wrapper>(this->current, Tedge_wrapper(this->base[this->current])); + return std::pair<NodeID, Tedge_wrapper>(this->current, Tedge_wrapper(this->base[this->current])); } /** diff --git a/src/linkgraph/linkgraphjob.h b/src/linkgraph/linkgraphjob.h index 9344ea246..cd7ece4b1 100644 --- a/src/linkgraph/linkgraphjob.h +++ b/src/linkgraph/linkgraphjob.h @@ -160,9 +160,9 @@ public: * @return Pair of the edge currently pointed to and the ID of its * other end. */ - SmallPair<NodeID, Edge> operator*() const + std::pair<NodeID, Edge> operator*() const { - return SmallPair<NodeID, Edge>(this->current, Edge(this->base[this->current], this->base_anno[this->current])); + return std::pair<NodeID, Edge>(this->current, Edge(this->base[this->current], this->base_anno[this->current])); } /** |