From 832b784db334bf4f12416bd428509179ecbaa451 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Thu, 8 Oct 2015 17:00:52 +0200 Subject: [PATCH] Add Container_t::getKeys --- include/hpp/manipulation/container.hh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/hpp/manipulation/container.hh b/include/hpp/manipulation/container.hh index a68751a..97c8344 100644 --- a/include/hpp/manipulation/container.hh +++ b/include/hpp/manipulation/container.hh @@ -28,6 +28,8 @@ namespace hpp { { public: typedef std::map <Key, Element> ElementMap_t; + typedef Key Key_t; + typedef Element Element_t; /// Add an element void add (const Key& name, const Element& element) @@ -55,6 +57,16 @@ namespace hpp { return l; } + template <typename ReturnType> + ReturnType getKeys () const + { + ReturnType l; + for (typename ElementMap_t::const_iterator it = map_.cbegin (); + it != map_.cend (); ++it) + l.push_back (it->first); + return l; + } + /// Return the underlying map. const ElementMap_t& getAll () const { -- GitLab