title: C++: How to Perform Deep Cloning of Generic Type
body: <p>To keep the long story short, I am unable to use the container from the STL and boost library and have to create my own. </p>
  
  <p>My own generic container is coded in VC++6 and I need to know how to manually allocate memory for generic types before storing it in my own container. The generic types are all struct that can contain nested struct. All struct be it nested or not will contain only primitive types like char*, int, bool etc.</p>
  
  <p>For example, when you call the insert function of std::vector, internally, std::vector will automatically perform a deep cloning of the generic type before storing it. </p>
  
  <p><strong>How can I duplicate this functionality (deep cloning of generic type) in my own container?</strong></p>
  
  <p>Please provide some sample code for performing deep cloning of generic type.</p>