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 #19799 is a reply to message #19798] Wed, 21 January 2009 22:03 Go to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Wed, 21 January 2009 12:55



I wonder if it works with polymorphic elements...


Nope.

Anyway, maybe you can look at BiArray::

	T&       AddHead(T *newt)              { bv.AddHead(newt); return *newt; }
	T&       AddTail(T *newt)              { bv.AddTail(newt); return *newt; }
	template <class TT> TT& CreateHead()   { TT *q = new TT; bv.AddHead(q); return *q; }
	template <class TT> TT& CreateTail()   { TT *q = new TT; bv.AddTail(q); return *q; }
	T       *DetachHead()                  { T *q = (T*) bv.Head(); bv.DropHead(); return q; }
	T       *DetachTail()                  { T *q = (T*) bv.Tail(); bv.DropTail(); return q; }


might provide the kind of operations you need.

Note that basically, polymorphy requires new... You can move that "outside", but it is hard to avoid it in generic case, because sizeof(T) varies.

Polypmorhy in general also excludes operator=.

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: Fri May 17 01:45:58 CEST 2024

Total time taken to generate the page: 0.02183 seconds