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 » BiArray::AddTail/AddHead pick problems
BiArray::AddTail/AddHead pick problems [message #16876] Fri, 18 July 2008 22:03 Go to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Hi,

Is it possibly that the AddTail/AddHead methods of BiArray use pick semantics rather than a deep copy constructor as is written in the documentation?
Here is the source of both methods:

void AddHead(const T& x) { bv.AddHead(new T(x)); }
void AddTail(const T& x) { bv.AddTail(new T(x)); }
[/source]

Currently I get nasty broken pick semantics errors with this Smile
Re: BiArray::AddTail/AddHead pick problems [message #16879 is a reply to message #16876] Sat, 19 July 2008 09:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ops, you are right. Should be:

void AddHead(const T& x) { bv.AddHead(DeepCopyNew(x)); }
void AddTail(const T& x) { bv.AddTail(DeepCopyNew(x)); }

Well, in fact, these methods might be confusing a bit, therefore I usually rather use

x.AddHead() <<= element;

... that is why this error escaped for so long Sad


Mirek
Re: BiArray::AddTail/AddHead pick problems [message #16886 is a reply to message #16876] Sat, 19 July 2008 13:06 Go to previous message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Thanks, I also used this workaround for now.

I hope it's fixed soon in svn Smile
Previous Topic: XMLNode error
Next Topic: zlib
Goto Forum:
  


Current Time: Fri Apr 26 12:55:44 CEST 2024

Total time taken to generate the page: 0.03485 seconds