本文整理汇总了C++中Array::GetCapacityI方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::GetCapacityI方法的具体用法?C++ Array::GetCapacityI怎么用?C++ Array::GetCapacityI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::GetCapacityI方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CondenseList
//==================================
// VRMenuMgrLocal::CondenseList
// keeps the free list from growing too large when items are removed
void VRMenuMgrLocal::CondenseList()
{
// we can only condense the array if we have a significant number of items at the end of the array buffer
// that are empty (because we cannot move an existing object around without changing its handle, too, which
// would invalidate any existing references to it).
// This is the difference between the current size and the array capacity.
int const MIN_FREE = 64; // very arbitray number
if ( ObjectList.GetCapacityI() - ObjectList.GetSizeI() < MIN_FREE )
{
return;
}
// shrink to current size
ObjectList.Resize( ObjectList.GetSizeI() );
// create a new free list of just indices < the new size
Array< int > newFreeList;
for ( int i = 0; i < FreeList.GetSizeI(); ++i )
{
if ( FreeList[i] <= ObjectList.GetSizeI() )
{
newFreeList.PushBack( FreeList[i] );
}
}
FreeList = newFreeList;
}