mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 01:10:10 +00:00
069d4255b9
Use std::variant. Store refId strings in unordered_set and use pointer to an item there. Inserts to unordered_set do not invalidate pointers to values so the pointer is always valid. Elements are not removed. Assume there is finite number of string refIds.
25 lines
477 B
C++
25 lines
477 B
C++
#include "formidrefid.hpp"
|
|
|
|
#include <ostream>
|
|
#include <sstream>
|
|
|
|
namespace ESM
|
|
{
|
|
std::string FormIdRefId::toString() const
|
|
{
|
|
return std::to_string(mValue);
|
|
}
|
|
|
|
std::string FormIdRefId::toDebugString() const
|
|
{
|
|
std::ostringstream stream;
|
|
stream << *this;
|
|
return stream.str();
|
|
}
|
|
|
|
std::ostream& operator<<(std::ostream& stream, FormIdRefId value)
|
|
{
|
|
return stream << "FormId{" << value.mValue << '}';
|
|
}
|
|
}
|