From 7183d4588f856a579c4ebd84230354a09eb66293 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Thu, 26 Oct 2017 10:43:57 +0200
Subject: [PATCH] Simplify WaypointEdge::waypoint getter

---
 include/hpp/manipulation/graph/edge.hh |  6 ++----
 src/graph/edge.cc                      | 10 +---------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/include/hpp/manipulation/graph/edge.hh b/include/hpp/manipulation/graph/edge.hh
index 43172d27..4a1cc5bf 100644
--- a/include/hpp/manipulation/graph/edge.hh
+++ b/include/hpp/manipulation/graph/edge.hh
@@ -238,10 +238,8 @@ namespace hpp {
 
           virtual bool applyConstraints (ConfigurationIn_t qoffset, ConfigurationOut_t q) const;
 
-          /// Return the inner waypoint.
-          /// \param EdgeType is either Edge or WaypointEdge
-          template <class EdgeType>
-          boost::shared_ptr <EdgeType> waypoint (const std::size_t index) const;
+          /// Return the index-th edge.
+          const EdgePtr_t& waypoint (const std::size_t index) const;
 
           /// Print the object in a stream.
           virtual std::ostream& dotPrint (std::ostream& os, dot::DrawingAttributes da = dot::DrawingAttributes ()) const;
diff --git a/src/graph/edge.cc b/src/graph/edge.cc
index ebad3265..edfa06bb 100644
--- a/src/graph/edge.cc
+++ b/src/graph/edge.cc
@@ -403,20 +403,12 @@ namespace hpp {
         edges_[index] = wEdge;
       }
 
-      template <>
-      EdgePtr_t WaypointEdge::waypoint <Edge> (const std::size_t index) const
+      const EdgePtr_t& WaypointEdge::waypoint (const std::size_t index) const
       {
         assert (index < edges_.size()); 
         return edges_[index];
       }
 
-      template <>
-      WaypointEdgePtr_t WaypointEdge::waypoint <WaypointEdge> (const std::size_t index) const
-      {
-        assert (index < edges_.size()); 
-        return HPP_DYNAMIC_PTR_CAST (WaypointEdge, edges_[index]);
-      }
-
       std::ostream& WaypointEdge::print (std::ostream& os) const
       {
         os << "|   |   |-- ";
-- 
GitLab