From c50ce9e29dfdeeab81aa3635de30dc459cdaa950 Mon Sep 17 00:00:00 2001 From: Denes Matetelki Date: Thu, 25 Apr 2013 21:22:32 +0200 Subject: [PATCH] graph has cctor and assign operator now --- graph.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/graph.h b/graph.h index 096c3e2..7c24bd8 100644 --- a/graph.h +++ b/graph.h @@ -49,6 +49,10 @@ public: Graph() : m_vertices() {} + Graph(const Graph& o) : m_vertices(o.m_vertices) {} + Graph& operator=(Graph o) { swap(o); return *this; } + void swap(Graph& o) { std::swap(m_vertices, o.m_vertices); } + // Capacity bool empty() const { return m_vertices.empty(); } @@ -129,7 +133,7 @@ public: void swap(reference_self_type other); edge_reference operator*() { resetEdge(); return m_edge; } - edge_pointer operator->() { resetEdge(); return m_edge; } + edge_pointer operator->() { resetEdge(); return &m_edge; } self_type &operator++() { advance(1); return *this; } self_type operator++(int) { self_type tmp(*this); advance(1); return tmp; } self_type operator+(difference_type n) { self_type tmp(*this); tmp.pos_ += n; return tmp; } @@ -186,9 +190,6 @@ private: std::list m_edges; }; - Graph(const Graph& o) { /** @todo impelemnt me */ } - Graph& operator=(const Graph& o) { /** @todo impelemnt me */ } - typename std::vector::const_iterator find(const_reference data) const; typename std::vector::iterator find(const_reference data);