From 7b06654bc99e581b971cf75139ccfa7862ac8fe9 Mon Sep 17 00:00:00 2001 From: Denes Matetelki Date: Tue, 12 Mar 2013 22:04:29 +0100 Subject: [PATCH] renaming private class Edge to EdgeTo --- graph.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/graph.h b/graph.h index 6c754cd..0bdfb64 100644 --- a/graph.h +++ b/graph.h @@ -24,11 +24,11 @@ public: private: - struct Edge { + struct EdgeTo { - Edge(const_reference destination, float weight = 0); - Edge(const Edge& other); - Edge& operator=(const Edge& other); + EdgeTo(const_reference destination, float weight = 0); + EdgeTo(const EdgeTo& other); + EdgeTo& operator=(const EdgeTo& other); pointer m_destination; float m_weight; @@ -44,7 +44,7 @@ private: void removeAllEdgesTo(const_reference destination); pointer m_data; - std::list m_edges; + std::list m_edges; }; @@ -124,7 +124,7 @@ public: // Edge template -Graph::Edge::Edge(const_reference destination, float weight) +Graph::EdgeTo::EdgeTo(const_reference destination, float weight) : m_destination(const_cast(&destination)) , m_weight(weight) { @@ -132,7 +132,7 @@ Graph::Edge::Edge(const_reference destination, float weight) } template -Graph::Edge::Edge(const Edge& other) +Graph::EdgeTo::EdgeTo(const EdgeTo& other) : m_destination(other.m_destination) , m_weight(other.m_weight) { @@ -140,7 +140,7 @@ Graph::Edge::Edge(const Edge& other) } template -typename Graph::Edge& Graph::Edge::operator=(const Edge& other) +typename Graph::EdgeTo& Graph::EdgeTo::operator=(const EdgeTo& other) { if (this != &other) { m_destination = other.m_destination; @@ -184,7 +184,7 @@ typename Graph::Vertex& Graph::Vertex::operator=(const Vertex& other) template void Graph::Vertex::addEdge(const_reference destination, float weight) { - Edge e(destination, weight); + EdgeTo e(destination, weight); m_edges.push_back(e); } @@ -192,7 +192,7 @@ template void Graph::Vertex::removeEdge(const_reference destination, float weight) { m_edges.erase(std::find_if(m_edges.begin(), m_edges.end(), - [&destination, &weight](const Edge& e) + [&destination, &weight](const EdgeTo& e) { return e.m_destination == destination && e.m_weight == weight;})); } @@ -201,7 +201,7 @@ template void Graph::Vertex::removeAllEdgesTo(const_reference destination) { std::remove_if(m_edges.begin(), m_edges.end(), - [&destination](const Edge& e) + [&destination](const EdgeTo& e) { return e.m_destination == destination; }); } @@ -319,7 +319,7 @@ std::vector::pointer> Graph::neighboursOf(const_reference d return retval; std::for_each((*vertex_it).m_edges.begin(), (*vertex_it).m_edges.end(), - [&retval](const Edge& e) + [&retval](const EdgeTo& e) { retval.push_back(e.m_destination); }); return retval; @@ -334,7 +334,7 @@ std::vector Graph::edgesBetween(const_reference source, const_referenc return retval; std::for_each((*vertex_it).m_edges.begin(), (*vertex_it).m_edges.end(), - [&retval, &destination](const Edge& e) + [&retval, &destination](const EdgeTo& e) { if (*(e.m_destination) == destination) retval.push_back(e.m_weight); });