solve hw-9

This commit is contained in:
JamesFlare1212
2025-04-15 22:08:11 -04:00
parent 9ec5d3d32c
commit a109046498
17 changed files with 1498 additions and 7 deletions

View File

@@ -0,0 +1,15 @@
#include "StringInterner.h"
const std::string* StringInterner::intern(const std::string& str) {
std::pair<std::unordered_set<std::string>::iterator, bool> result = pool.insert(str);
return &(*result.first);
}
const std::string* StringInterner::intern(std::string&& str) {
std::pair<std::unordered_set<std::string>::iterator, bool> result = pool.insert(std::move(str));
return &(*result.first);
}
const std::string* StringInterner::getEmptyString() {
return intern("");
}