From 92bea9e949ff9ea9e40ef7ba038cc45cb8490180 Mon Sep 17 00:00:00 2001 From: ipknHama Date: Sun, 17 Sep 2017 14:02:46 +0900 Subject: [PATCH] Change vector to unordered_map for get_dict --- include/crow/query_string.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/crow/query_string.h b/include/crow/query_string.h index 274044136..78ccc677f 100644 --- a/include/crow/query_string.h +++ b/include/crow/query_string.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -220,8 +221,6 @@ inline boost::optional> qs_dict_name2kv(cons skip_to_brace_open++; skip_to_brace_close = strcspn(qs_kv[i], "]"); - std::cout << skip_to_brace_open << " FUFUU " << skip_to_brace_close << std::endl; - if ( skip_to_brace_open <= skip_to_brace_close && skip_to_brace_open > 0 && skip_to_brace_close > 0 && @@ -381,16 +380,15 @@ namespace crow return ret; } - std::vector> get_dict (const std::string& name) const + std::unordered_map get_dict (const std::string& name) const { - std::vector> ret; - std::string plus = name; + std::unordered_map ret; int count = 0; while(1) { - if (auto element = qs_dict_name2kv(plus.c_str(), key_value_pairs_.data(), key_value_pairs_.size(), count++)) - ret.push_back(*element); + if (auto element = qs_dict_name2kv(name.c_str(), key_value_pairs_.data(), key_value_pairs_.size(), count++)) + ret.insert(*element); else break; }