Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Deep copy problems

Reply
Thread Tools

Deep copy problems

 
 
Ace Alexander
Guest
Posts: n/a
 
      07-08-2003
I searched the internet and this news group and am still having
problems grasping this concept. I have:
struct file
{
bool open;
vector<file*>my_files;
};

I initialize a file:
file main_file;
I also set all the pointers of my_files, and the pointers of those
my_files in main_file.

I then create an array which I want to use a deep copy of main_file.
Ex: file_arr[0]=main_file;

What is throwing me off is the file* vector my_files. How do I do a
deep copy of the struct file so that it also deep copies the file*
array?

Thank you,
Ace Alexander
 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      07-08-2003

"Ace Alexander" <(E-Mail Removed)> wrote in message news:(E-Mail Removed) om...

> What is throwing me off is the file* vector my_files. How do I do a
> deep copy of the struct file so that it also deep copies the file*
> array?
>

Depends on how you deep copy file*.

It's not clear form the little you've presented here what you are doing.

Is there some reason why you are using file*'s in the vector rather than just
file?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deep Copy smart pointer not requiring virtual copy constructor Nindi73@yahoo.co.uk C++ 11 11-14-2006 02:23 PM
what is Deep Copy, shallow copy and bitwises copy.? saxenavaibhav17@gmail.com C++ 26 09-01-2006 09:37 PM
is dict.copy() a deep copy or a shallow copy Alex Python 2 09-05-2005 07:01 AM
How to overload operator= to have both deep copy and shallow copy semantics bluekite2000@gmail.com C++ 1 06-24-2005 05:28 PM
deep/shallow copy - constructor v Object.copy() VisionSet Java 8 04-29-2004 10:41 PM



Advertisments