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 » Quick bi-array
Re: Quick bi-array [message #19796 is a reply to message #19795] Wed, 21 January 2009 14:53 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14265
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Wed, 21 January 2009 08:38

I need a deque-like container where I may reserve space for a number of elements, and the main requirement is that removing element doesn`t make actual memory deallocation, as well as adding element by reference doesn`t actually make any memory allocation or constructor call. I want add/delete mechanism to be as quick as possible: all the actions are to be done within reserved set of elements. Adding is just calling operator= to internal reserved container element, removing is just marking it unused. Something like that.
Is there any appropriate container in U++?

Looking into sources, it looks like BiVector and BiArray use new/delete and don`t match requirements.


BiVector would call only single new at Reserve, then nothing else.

BiArray behaves as Array, of course (each element is newed/deleted).

It is not easy to decipher your requirements, but if you mean by 'reference' what I understand, I guess something like

BiVector<Element *>

should be fine and would never call new/delete after Reserve, as long as you do not exceed the reserved size.

Would you be more specific, I would try to find more detailed answer.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to load only header of the file with LoadFromFile?
Next Topic: VectorMap inside VectorMap
Goto Forum:
  


Current Time: Tue Jul 08 23:25:43 CEST 2025

Total time taken to generate the page: 0.03741 seconds