diff options
| author | randomdan <randomdan@localhost> | 2014-06-05 10:58:15 +0000 | 
|---|---|---|
| committer | randomdan <randomdan@localhost> | 2014-06-05 10:58:15 +0000 | 
| commit | fdde83d713473e74069dcc5ee57cc6e504a82901 (patch) | |
| tree | 9df94e38395123e7d2e87754896cc14b56aad837 | |
| parent | Adds unit tests covering class of builtin types and class of optional built i... (diff) | |
| download | slicer-fdde83d713473e74069dcc5ee57cc6e504a82901.tar.bz2 slicer-fdde83d713473e74069dcc5ee57cc6e504a82901.tar.xz slicer-fdde83d713473e74069dcc5ee57cc6e504a82901.zip | |
Hooks is now a vector, not a map, to maintain the output order according to the slice
| -rw-r--r-- | slicer/slicer/modelParts.h | 7 | 
1 files 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 <stdexcept>  #include <boost/function.hpp>  #include <boost/foreach.hpp> +#include <vector>  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<std::string, HookPtr> Hooks; +			typedef std::vector<std::pair<const std::string, HookPtr> > Hooks;  		private:  			static Hooks hooks; | 
