How to copy a structure with pointers to data inside (so to copy pointers and data they point to)?

Posted by Kabumbus on Stack Overflow See other posts from Stack Overflow or by Kabumbus
Published on 2011-01-31T06:05:55Z Indexed on 2011/01/31 7:25 UTC
Read the original article Hit count: 136

Filed under:
|
|
|

so I have a structure like

struct GetResultStructure
{
            int length;
    char* ptr;
};

I need a way to make a full copy of it meaning I need a copy to have a structure with new ptr poinnting on to copy of data I had in original structure. Is It any how possible? I mean any structure I have which contains ptrs will have some fields with its lengths I need a function that would copy my structure coping all ptrs and data they point to by given array of lengthes... Any cool boost function for it? Or any way how to create such function?

© Stack Overflow or respective owner

Related posts about c++

Related posts about memory