Deep copy problems

Discussion in 'C++' started by Ace Alexander, Jul 8, 2003.

  1. 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
     
    Ace Alexander, Jul 8, 2003
    #1
    1. Advertising

  2. Ace Alexander

    Ron Natalie Guest

    "Ace Alexander" <> wrote in message news:...

    > 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?
     
    Ron Natalie, Jul 8, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VisionSet
    Replies:
    8
    Views:
    4,931
    Tris Orendorff
    Apr 29, 2004
  2. Alex
    Replies:
    2
    Views:
    1,258
  3. Replies:
    1
    Views:
    552
    Victor Bazarov
    Jun 24, 2005
  4. Replies:
    26
    Views:
    2,145
    Roland Pibinger
    Sep 1, 2006
  5. Replies:
    11
    Views:
    1,012
    Nindi
    Nov 14, 2006
Loading...

Share This Page