1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Update Utilities.hpp

This commit is contained in:
Sandu Liviu Catalin 2021-09-19 14:21:57 +03:00
parent 62b9504d43
commit cae745378d

View File

@ -169,7 +169,21 @@ template < class T, class W > struct DpVectorProxy
// Return the object from the cache // Return the object from the cache
return mVec[static_cast< size_t >(i)].first; return mVec[static_cast< size_t >(i)].first;
} }
SQMOD_NODISCARD LightObj & Get(SQInteger i) { ValidIdx_(i); return Get_(i); } SQMOD_NODISCARD LightObj & Get(SQInteger i)
{
// Was the referenced vector modified?
if (mVec.size() < Valid().size())
{
// Synchronize the size
mVec.resize(mPtr->size());
// Synchronize the cache
CacheSync();
}
// Validate index
ValidIdx_(i);
// Perform the request
return Get_(i);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify a value from the container. * Modify a value from the container.
*/ */