Use copies of strings for the cache instead of string_views. Apparently my assumption was wrong.
This commit is contained in:
parent
de07cf91bc
commit
83d3ce9f1f
@ -8,9 +8,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// note: the implementation assumes that std::vector moves the strings on resize and that strings don't reallocate when moved
|
|
||||||
// while that should be the case for any sane STL implementation it may cause dangling pointers if it's not
|
|
||||||
|
|
||||||
namespace mijin
|
namespace mijin
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -52,9 +49,9 @@ static std::shared_mutex& getGlobalNamesMutex()
|
|||||||
return mutex;
|
return mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::unordered_map<std::string_view, std::size_t>& getLocalNameCache()
|
static std::unordered_map<std::string, std::size_t>& getLocalNameCache()
|
||||||
{
|
{
|
||||||
static std::unordered_map<std::string_view, std::size_t> cache;
|
static std::unordered_map<std::string, std::size_t> cache;
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user