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 » 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 Go to previous messageGo to previous message
kohait00 is currently offline  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 Smile

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 Smile 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++
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PolyDeepCopyNew: MSC / GCC differ in behaviour
Next Topic: RichPickToValue PROPOSAL
Goto Forum:
  


Current Time: Tue Jun 17 05:23:46 CEST 2025

Total time taken to generate the page: 0.04401 seconds