problem about shallow-copy-Record and share programming errors


  • Shane MacLaughlin
    c++ performance shallow-copy
    Say I have a class, something like the following;class MyClass { public:MyClass();int a,b,c;double x,y,z; };#define PageSize 1000000MyClass Array1[PageSize],Array2[PageSize];If my class has not pointers or virtual methods, is it safe to use the following?memcpy(Array1,Array2,PageSize*sizeof(MyClass));The reason I ask, is that I’m dealing with very large collections of paged data, as decribed here, where performance is critical, and memcpy offers significant performance advanta

Originally posted 2013-10-17 01:48:58.