From 944838fab66dc9dee3fc0ab655798fcab81c7e99 Mon Sep 17 00:00:00 2001 From: randomdan Date: Thu, 5 Jun 2014 10:58:15 +0000 Subject: Hooks is now a vector, not a map, to maintain the output order according to the slice --- slicer/slicer/modelParts.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h index 0bdcb25..b845348 100644 --- a/slicer/slicer/modelParts.h +++ b/slicer/slicer/modelParts.h @@ -10,6 +10,7 @@ #include #include #include +#include namespace Slicer { class IncorrectElementName : public std::invalid_argument { @@ -181,7 +182,9 @@ namespace Slicer { ModelPartPtr GetChild(const std::string & name) override { - auto childitr = hooks.find(name); + auto childitr = std::find_if(hooks.begin(), hooks.end(), [&name](const typename Hooks::value_type & h) { + return h.first == name; + }); if (childitr != hooks.end()) { return childitr->second->Get(GetModel()); } @@ -190,7 +193,7 @@ namespace Slicer { virtual T * GetModel() = 0; - typedef std::map Hooks; + typedef std::vector > Hooks; private: static Hooks hooks; -- cgit v1.2.3