Files
CSCI-1200/hws/tiktok_trends/StringInterner.cpp
JamesFlare1212 a109046498 solve hw-9
2025-04-15 22:10:48 -04:00

15 lines
495 B
C++

#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("");
}