From 2fb94e3c4c4ade042fc1944f1bfa64609bff40b4 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 24 Apr 2015 17:09:17 -0700 Subject: 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. --- cpp/012transform | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cpp/012transform') diff --git a/cpp/012transform b/cpp/012transform index 59b87e69..888c7585 100644 --- a/cpp/012transform +++ b/cpp/012transform @@ -17,7 +17,7 @@ vector Transform; void transform_all() { //? cout << "AAA transform_all\n"; //? 1 for (size_t t = 0; t < Transform.size(); ++t) { - for (unordered_map::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { + for (map::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::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { + for (map::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) { -- cgit 1.4.1-2-gfad0