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 » T* Detach() for ArrayMap
Re: T* Detach() for ArrayMap [message #24881 is a reply to message #24874] Tue, 02 February 2010 22:52 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14256
Registered: November 2005
Ultimate Member
kohait00 wrote on Tue, 02 February 2010 10:31

hi there

i ran into the need of
T* ArrayMap<K, T>::Detach(const K & key)

function. normal Array<T> *does* have one
T* Array<T>::Detach(int i);

since one can do a
T & Add(const K & key, T * newt)


on both, Array<T> and ArrayMap<K, T>, it would be consistent to have a Detach() function on both cotainer types.

so maybe the following lines could be added to Map.h
T* Detach(int i) { T *t = &B::value[i]; B::key.Remove(i); return t; }



Hm, is that correct implementation?

I would say something like

T* Detach(int i) { B::key.Remove(i); return B::value.Detach(i); }


is the correct one?

Another problem there is that this kind of detach is quite slow. Maybe we need DetachUnlink too (?).

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: VC2010
Next Topic: Symlink/Shortcut support
Goto Forum:
  


Current Time: Fri May 02 13:57:23 CEST 2025

Total time taken to generate the page: 0.04391 seconds