15 lines
495 B
C++
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("");
|
|
} |