I am attempting to create a Clipboard stack in C#. Clipboard data is stored in System.Windows.Forms.DataObject objects. I wanted to store each clipboard entry (IDataObject) directly in a Generic list. Due to the way Bitmaps (seem to be) stored I am thinking I need to perform a deep copy first before I add it to the list.
I attempted to...
Given a data structure (e.g. a hash of hashes), what's the clean/recommended way to make a deep copy for immediate use? Assume reasonable cases, where the data's not particularly large, no complicated cycles exist, and readability/maintainability/etc. are more important than speed at all costs.
I know I can use Storable, Clone, Clone::M...
How can I deep copy an irregularly shaped 2D array in Java?
Ie.
int[][] nums = {{5},
{9,4},
{1,7,8},
{8,3,2,10}}
I'm unable to use Arrays.arrayCopy() for some reason (versioning?)
Thanks
...
If my understanding of deep and shallow copying is correct my question is an impossible one.
If you have an array (a[10]) and perform a shallow copy (b[20]) wouldn't this be impossible as the data in b wouldn't be contiguous?
If i've got this completely wrong could someone advise a fast way to immitate (in c#) c++'s ability to do a real...
Alright, so I'm trying out C++ for the first time, as it looks like I'll have to use it for an upcoming course in college. I have a couple years of programming under my belt, but not much in the non-garbage-collected world.
I have a class, a Node for use in a doubly linked list. So basically it has a value and two pointers to other Node...
Hi All,
Is there any built-in function in Objective-C allows me to deep copy a NSMutableArray?
I looked around, some people say [aMutableArray copyWithZone:nil] works as deep copy. But I tried it seems no.
Right now I am manually doing the copy one by one (a 9*9 array):
//deep copy a 9*9 mutable array to a passed-in reference array
...
What is the best way to deep clone an interconnected set of objects? Example:
class A {
B theB; // optional
// ...
}
class B {
A theA; // optional
// ...
}
class Container {
A[] a;
B[] b;
}
The obvious thing to do is walk the objects and deep clone everything as I come to it. This creates a problem however -...
Essentially what I want to do is copy a WebBrowser object such that I can do the equivalent of "Open In New Tab" or "Open In New Window" actions, maintaining any posted data. I don't just want to navigate to the same URL as in the original WebBrowser object, rather I want to repeat the HttpWebRequest. Is this possible? How?
...
We have an application that performs comparisons on data objects to determine if one version of the object is different than another. Our application also does some extensive caching of these objects, and we've run into a bit of a performance issue when it comes to doing these comparisons.
Here's the workflow:
Data item 1 is the curre...
Hello there, I was wondering in how does exactly deepcopy work in the following context:
from copy import deepcopy
def copyExample:
self.myDict = {}
firstPosition = "First"
firstPositionContent = ["first", "primero"]
secondPosition = "Second"
secondPositionContent = ["second"]
self.myDict[firstPosition] = fir...
I am trying to create a list of LINQ to SQL objects which i will add to the datacontext and insert later. When i do call SubmitChanges() though I get an error saying the Postcode foreign key for the WeatherForecast object is null.
I appears that when List.Add() is called it doesn't do a deep copy of the dependent objects. Is there anyw...
So $array is an array of which all elements are references.
I want to append this array to another array called $results (in a loop), but since they are references, PHP copies the references and $results is full of identical elements.
So far, the best working solution is:
$results[] = unserialize(serialize($array));
which I fear t...
I'm doing some exploration of operator-overloading at the moment whilst re-reading some of my old University text-books and I think I'm mis-understanding something, so hopefully this will be some nice easy reputation for some answerers. If this is a duplicate please point me in the right direction.
I've created a simple counter class th...
In Scala, does AnyRef.clone perform a shallow or deep copy?
...
What is the easiest way to deeply clone (copy) a mutable Scala object?
...
I have tree structure of widgets e.g. collection contains models and model contains widgets
I wan to copy whole collection, copy.deepcopy is faster in comparison to 'pickle and de-pickle'ing the object but cPickle as being written in C is much faster, so
so why shouldn't I(we) always be using cPickle instead of deepcopy?
Is there any ...
I have the following two structs where "child struct" has a "rusage struct" as an element.
Then I create two structs of type "child" let's call them childA and childB
How do I copy just the rusage struct from childA to childB?
typedef struct{
int numb;
char *name;
pid_t pid;
long userT;
...
Suppose I have the following (simplified case):
class Color;
class IColor
{
public:
virtual Color getValue(const float u, const float v) const = 0;
};
class Color : public IColor
{
public:
float r,g,b;
Color(float ar, float ag, float ab) : r(ar), g(ag), b(ab) {}
Color getValue(const float u, const float v) const
...
Before I start coding this myself and reinventing the wheel, how do you copy a hash of hashes without duplicating the hashrefs?
I'm reading a hash of hash of hashes via Config::General. i.e., the data structure is:
my %config = ( group => { item1 => { foo => 'value',
bar => 'value',
...
The following in a Javascript console:
var a = {'foo': []};
var b = {};
for (var key in a) {
b[key] = a[key];
}
a['foo'].push(1);
console.log(b);
Yields:
Object foo=[1]
I want to make a copy by value in b of each array for each key in a. Is there an easier way?
...