deep-copy Questions

6

Solved

I am trying to create a copy of a CMSampleBuffer as returned by captureOutput in a AVCaptureVideoDataOutputSampleBufferDelegate. Since the CMSampleBuffers come from a preallocated pool of (15) buff...
Nevers asked 12/7, 2016 at 17:24

4

Solved

I have problem with javascript object(array) deep copy. I read many good way to deal with it. And I also know that jQuery has $.extend API to this problem. But my question is: Can I just using JSON...
Audit asked 18/12, 2013 at 15:39

13

Solved

import copy a = "deepak" b = 1, 2, 3, 4 c = [1, 2, 3, 4] d = {1: 10, 2: 20, 3: 30} a1 = copy.copy(a) b1 = copy.copy(b) c1 = copy.copy(c) d1 = copy.copy(d) print("immutable - id(a)==id(a1)", id(...

13

Solved

import copy a = "deepak" b = 1, 2, 3, 4 c = [1, 2, 3, 4] d = {1: 10, 2: 20, 3: 30} a1 = copy.copy(a) b1 = copy.copy(b) c1 = copy.copy(c) d1 = copy.copy(d) print("immutable - id(a)==id(a1)", id(...
Renounce asked 22/6, 2013 at 2:15

13

Solved

import copy a = "deepak" b = 1, 2, 3, 4 c = [1, 2, 3, 4] d = {1: 10, 2: 20, 3: 30} a1 = copy.copy(a) b1 = copy.copy(b) c1 = copy.copy(c) d1 = copy.copy(d) print("immutable - id(a)==id(a1)", id(...

6

Solved

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: fl...
Plainsong asked 28/9, 2009 at 14:8

5

Solved

I want to copy a 2D list, so that if I modify one list, the other is not modified. For a one-dimensional list, I just do this: a = [1, 2] b = a[:] And now if I modify b, a is not modified. But...
Baptlsta asked 29/3, 2010 at 23:10

5

Solved

I want to duplicate an instance of a data structure. Since go does not have any builtins, I am using a third party library: https://github.com/emirpasic/gods. For example, I may try use deep copy...
Incorrigible asked 29/5, 2019 at 7:29

2

Solved

I have a class that converts a dictionary to an object like this class Dict2obj(dict): __getattr__= dict.__getitem__ def __init__(self, d): self.update(**dict((k, self.parse(v)) for k, v in d....
Civilian asked 28/10, 2015 at 9:52

12

Solved

Could someone explain how exactly the copy method for Kotlin data classes work? It seems like for some members, a (deep) copy is not actually created and the references are still to the original. ...
Williford asked 17/11, 2017 at 21:23

3

Solved

I am dealing with objects that allocate memory for internal use. Currently, they are not copyable. E.g. class MyClass { public: MyClass() { Store = new int; } ~MyClass() { delete Store; } privat...
Breakwater asked 1/8, 2023 at 7:40

8

Solved

How can I copy every element of an array (where the elements are objects), into another array, so that they are totally independent? I don't want changing an element in one array to affect the othe...
Ropable asked 26/4, 2013 at 9:20

59

Solved

I want to do something like: MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the o...
Capua asked 17/9, 2008 at 0:6

59

Solved

I want to do something like: MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the o...
Vicious asked 17/9, 2008 at 0:6

59

Solved

I want to do something like: MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the o...
Love asked 17/9, 2008 at 0:6

59

Solved

I want to do something like: MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the o...
Confidant asked 17/9, 2008 at 0:6

59

Solved

I want to do something like: MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the o...
Provost asked 17/9, 2008 at 0:6

59

Solved

I want to do something like: MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the o...
Anthodium asked 17/9, 2008 at 0:6

59

Solved

I want to do something like: MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the o...
Gifford asked 17/9, 2008 at 0:6

59

Solved

I want to do something like: MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); And then make changes to the new object that are not reflected in the o...
Lingenfelter asked 17/9, 2008 at 0:6

40

Solved

When copying an array in JavaScript to another array: var arr1 = ['a','b','c']; var arr2 = arr1; arr2.push('d'); // Now, arr1 = ['a','b','c','d'] I realized that arr2 refers to the same array as a...
Cornwall asked 20/9, 2011 at 13:38

3

Solved

I tried googling this but only objected oriented languages pop up as results. From my understanding a shallow copy is copying certain members of a struct. so lets say a struct is typedef struct ...
Chari asked 7/3, 2013 at 17:49

4

Solved

I'm trying to improve the speed of an algorithm and, after looking at which operations are being called, I'm having difficulty pinning down exactly what's slowing things up. I'm wondering if Python...
Unscathed asked 21/1, 2012 at 22:48

2

Solved

In the following example I would expect deepcopy to create a copy of field and not just copy the reference. What happens here and is there an easy way around it? from copy import deepcopy class T...
Williams asked 21/8, 2013 at 17:46

9

Solved

I would like to make a deepcopy of a function in Python. The copy module is not helpful, according to the documentation, which says: This module does not copy types like module, method, stack tr...
Olive asked 29/6, 2011 at 21:44

© 2022 - 2024 — McMap. All rights reserved.