[*] AuTryReserve should not assume all reservable containers have a stated capacity

This commit is contained in:
Reece Wilson 2023-08-07 23:13:00 +01:00
parent f0a36d431a
commit bc1f673881

View File

@ -300,9 +300,12 @@ inline bool AuTryInsert(Container &container, const Key_t &key, Type_t &&value,
template <class Container>
inline bool AuTryReserve(Container &container, AuUInt uRequired)
{
if (container.capacity() >= uRequired)
if constexpr (__audetail::AuHascapacity_v<Container>)
{
return true;
if (container.capacity() >= uRequired)
{
return true;
}
}
AUROXTL_COMMODITY_TRY
@ -314,7 +317,14 @@ inline bool AuTryReserve(Container &container, AuUInt uRequired)
return false;
}
return container.capacity() >= uRequired;
if constexpr (__audetail::AuHascapacity_v<Container>)
{
return container.capacity() >= uRequired;
}
else
{
return true;
}
}
template <class Container>