Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Vector::SetCount()
Vector::SetCount() [message #19096] Wed, 12 November 2008 13:38 Go to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Until very recently I hadn't realised that SetCount actually deallocates memory when the count is less than the allocation. This means you can't use a Vector for an iteration of an algorithm, then reuse the memory for the next iteration without deallocating/reallocating it.

This isn't a major issue in itself as I can always hack it in myself if necessary, but there is currently no mention of the deallocation in the documentation. This is particularly misleading because the allocation of extra space is specifically mentioned:
Quote:

Changes count of elements in Vector to specified value. If required number of elements is greater than actual number, newly added elements are default constructed. If Vector has to increase capacity, the new capacity will exactly match required number of elements (unlike SetCountR).

Perhaps it could be changed? And would it be possible to add a function that allows setting of items without deallocation?
 
Read Message
Read Message
Read Message
Previous Topic: Win 98
Next Topic: [Solved] Any::dtor fails after it is picked
Goto Forum:
  


Current Time: Sun May 12 12:54:42 CEST 2024

Total time taken to generate the page: 0.02434 seconds