Home » U++ Library support » U++ Core » Value: no deep copy support?
Re: Value: no deep copy support? [message #29454 is a reply to message #29453] |
Thu, 21 October 2010 20:17   |
 |
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
it was sort of retorical question anyway. RawValue / RichValue / ValueArray in any case do represent data 'container' and not only the information it has. and as a container one wants to have access modify access to the container.. (int 123 is information, int& 123 references a *container* which happens to have 123 as information).
it's difficult to explain actually.
actually, i dont see much of the point to have Value reference anything else than the intrinsic datatypes, if they are immutable. maybe i need some time to wrap my mind around Value fully 
maybe i need to think of it as a reference to a bit of very volatile readonly data..that is created somewhere in the dust, and if it ceases to be of importance it becomes dust again..
you actually never need to reference the same data packet inside to rely on its information. if its content (or better the information it represents) is about to be altered, this info is created. so Value is not about the place to store sth. but about to represent some information, speeded up by ref count. sorry, trying to understand by describing for the purpose of referencing a container maybe one should use Ptr<T>..
you asked about the const thing:
http://www.ultimatepp.org/srcdoc$Core$UserValue$en-us.html
Quote: |
Note that the function ValueTo returns a constant reference. This is consistent with default Value behaviour, according to which data once put into Value should never change afterwards. This is necessary because, upon copying, multiple variables of type Value can hold the same data "packet" and changing its contents would affect all these copies, which is normally undesirable. If you break the const-ness using a mutable member or by a const_cast, you should not forget that.
|
this actually adds to understand Value as a container for sth. ("packet", "contents").
BTW: maybe you could help me with the ValueArray understanding in another thread here in Core++
|
|
|
 |
|
Value: no deep copy support?
By: kohait00 on Thu, 02 September 2010 15:58
|
 |
|
Re: Value: no deep copy support?
By: mirek on Mon, 06 September 2010 10:38
|
 |
|
Re: Value: no deep copy support?
By: mirek on Mon, 06 September 2010 10:39
|
 |
|
Re: Value: no deep copy support?
By: kohait00 on Wed, 20 October 2010 16:08
|
 |
|
Re: Value: no deep copy support?
By: kohait00 on Wed, 20 October 2010 16:55
|
 |
|
Re: Value: no deep copy support?
By: mirek on Wed, 20 October 2010 23:16
|
 |
|
Re: Value: no deep copy support?
By: kohait00 on Thu, 21 October 2010 08:47
|
 |
|
Re: Value: no deep copy support?
By: mirek on Thu, 21 October 2010 19:06
|
 |
|
Re: Value: no deep copy support?
By: kohait00 on Thu, 21 October 2010 20:17
|
 |
|
Re: Value: no deep copy support?
By: mirek on Thu, 21 October 2010 23:23
|
 |
|
Re: Value: no deep copy support?
By: kohait00 on Thu, 21 October 2010 23:30
|
Goto Forum:
Current Time: Tue Jun 17 05:23:46 CEST 2025
Total time taken to generate the page: 0.04401 seconds
|