diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-04-24 17:09:17 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-04-24 17:09:17 -0700 |
commit | 2fb94e3c4c4ade042fc1944f1bfa64609bff40b4 (patch) | |
tree | a3b649a53a0b634d3110daf2f8357d372a560841 /cpp/012transform | |
parent | 544a1f1e17d909673f08a50b97fc9d00df431eb4 (diff) | |
download | mu-2fb94e3c4c4ade042fc1944f1bfa64609bff40b4.tar.gz |
1166
Why did I think STL's map wasn't efficient? It has logarithmic complexity (maintains a tree internally) and is faster than hashing for small containers. It's the more portable solution and should be what I turn to by default.
Diffstat (limited to 'cpp/012transform')
-rw-r--r-- | cpp/012transform | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cpp/012transform b/cpp/012transform index 59b87e69..888c7585 100644 --- a/cpp/012transform +++ b/cpp/012transform @@ -17,7 +17,7 @@ vector<transform_fn> Transform; void transform_all() { //? cout << "AAA transform_all\n"; //? 1 for (size_t t = 0; t < Transform.size(); ++t) { - for (unordered_map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { + for (map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { recipe& r = p->second; if (r.steps.empty()) continue; if (r.transformed_until != t-1) continue; @@ -30,7 +30,7 @@ void transform_all() { void parse_int_reagents() { //? cout << "parse_int_reagents\n"; //? 1 - for (unordered_map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { + for (map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { recipe& r = p->second; if (r.steps.empty()) continue; for (size_t index = 0; index < r.steps.size(); ++index) { |