Deep copy problems

A

Ace Alexander

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
 
R

Ron Natalie

Ace Alexander said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top