Thread-local copy of data structure

Ali Çehreli acehreli at yahoo.com
Tue Jul 30 18:34:46 PDT 2013


On 07/30/2013 01:15 PM, Marek Janukowicz wrote:

 > class A {
 >   B [] arr;
 > }

 > Now "a" in my task is the same as "a" in main thread and I'd like a local
 > copy - to be precise I need to make changes to a in the task, but they
 > should not affect main copy.

Fine: That is a requirement of your program. Another program may have 
different requirements.

 > Is it possible to somehow create copy automatically when creating a 
task, or
 > do I need to create it myself?

It is possible to write a general function that performs deep copying of 
members and others have implemented such functions.

 > If the latter - is there anything in std lib that helps with creation of
 > deep clones

I doubt it.

Ali



More information about the Digitalmars-d-learn mailing list