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 » Developing U++ » U++ Developers corner » Core chat... (reference counted pointers etc.)
Re: Core chat... [message #12351 is a reply to message #12350] Thu, 25 October 2007 23:47 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1308
Registered: September 2007
Ultimate Contributor
luzr wrote on Thu, 25 October 2007 23:38



Well, performance is nice, but really not that important.

What IS imporant is that there is only ONE PLACE where instance of (possibly) non-copyable object can exist.



I don't get the point...
Quote:


Quote:


array<int> a, b;
a.At(1000) = 1;
b = a;      <== b and a share same memory area
a[10] = 2;  <== here an automatic deep copy, ok
b[10] = 2;  <== here no deep copy, just array access, ok




Note that above is impossible to implement reliably in C++ (as long as you want read operator[] access to perform no copy at all).


Yes, you got the true caveat of my way.... now maybe you understand *why* I do miss __property construct in c++.... Mad

Quote:



Sure. Anyway, the real point of pick is here:

Array<Ctrl> CreateWidgets()
{
    Array<Ctrl> x;
    ...
    return x;
}



uh ? My Array class behaves exactly as yours, here...
Array<Ctrl> CreateWidgets()
{
    Array<Ctrl> x;  <== here, a single reference to memory object
    ...
    return x; <== here, for a while, 2 references to THE SAME memory object
}

ctrls = CreateWidgets() <== here, the first reference is destroyed, leaving a single reference in ctrls


In your pick_ behaviour, you have a single reference ever to a single memory object. In my case, I have just for a while 2 references to a single memory object, then the first one is released leaving the same result as yours.

Max
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ValueMap
Next Topic: Quick and dirty solution to .icpp problem...
Goto Forum:
  


Current Time: Sat May 10 04:55:57 CEST 2025

Total time taken to generate the page: 0.04001 seconds