Keep PycSet objects marshalled from files in order too

This commit is contained in:
Michael Hansen
2023-02-16 22:01:31 -08:00
parent ded8adfba2
commit 1fcbf4cd4b
3 changed files with 4 additions and 18 deletions

View File

@@ -134,7 +134,7 @@ void PycSet::load(PycData* stream, PycModule* mod)
{
m_size = stream->get32();
for (int i=0; i<m_size; i++)
m_values.insert(LoadObject(stream, mod));
m_values.push_back(LoadObject(stream, mod));
}
bool PycSet::isEqual(PycRef<PycObject> obj) const
@@ -154,16 +154,3 @@ bool PycSet::isEqual(PycRef<PycObject> obj) const
}
return true;
}
PycRef<PycObject> PycSet::get(int idx) const
{
if (idx < 0)
throw std::out_of_range("Set index out of range");
auto it = m_values.cbegin();
while (idx-- && it != m_values.cend())
++it;
if (it == m_values.cend())
throw std::out_of_range("Set index out of range");
return *it;
}