@@ -41,7 +41,7 @@ def generate_base_vocabulary_header():
4141 f"{ HEADER_CLANG_FORMAT_OFF } \n "
4242 "#ifndef __VOCABULARY_H__\n "
4343 "#define __VOCABULARY_H__\n \n "
44- "#include <map >\n "
44+ "#include <unordered_map >\n "
4545 "#include <string>\n "
4646 "#include <vector>\n "
4747 "#include <memory>\n "
@@ -51,7 +51,7 @@ def generate_base_vocabulary_header():
5151 "class VocabularyBase {\n "
5252 "public:\n "
5353 " virtual ~VocabularyBase() {}\n "
54- " virtual const std::map <std::string, IR2Vec::Vector>& getVocabulary() const = 0;\n "
54+ " virtual const std::unordered_map <std::string, IR2Vec::Vector>& getVocabulary() const = 0;\n "
5555 "};\n \n "
5656 "class VocabularyFactory {\n "
5757 "public:\n "
@@ -69,24 +69,22 @@ def generate_vocabulary_class(vocab_file, class_name):
6969 f"{ HEADER_CLANG_FORMAT_OFF } \n "
7070 f"#ifndef __{ class_name .upper ()} __\n "
7171 f"#define __{ class_name .upper ()} __\n \n "
72- f"#include <map >\n "
72+ f"#include <unordered_map >\n "
7373 f"#include <string>\n "
7474 f"#include <vector>\n "
7575 f'#include "Vocabulary.h" // Include the base class\n \n '
7676 f"namespace IR2Vec {{\n \n "
7777 f"class { class_name } : public VocabularyBase {{\n "
7878 f"public:\n "
79- f" const std::map <std::string, IR2Vec::Vector>& getVocabulary() const override{{\n "
79+ f" const std::unordered_map <std::string, IR2Vec::Vector>& getVocabulary() const override{{\n "
8080 f" return vocabulary;\n "
8181 f" }}\n "
8282 f"private:\n "
83- f" static const std::map <std::string, IR2Vec::Vector> vocabulary;\n "
83+ f" static const std::unordered_map <std::string, IR2Vec::Vector> vocabulary;\n "
8484 f"}};\n "
8585 )
8686
87- opening = (
88- f"\n const std::map<std::string, IR2Vec::Vector> { class_name } ::vocabulary = {{\n "
89- )
87+ opening = f"\n const std::unordered_map<std::string, IR2Vec::Vector> { class_name } ::vocabulary = {{\n "
9088 closing = """\
9189 };
9290} // namespace IR2Vec
0 commit comments