#include "pip.h" struct A { double x1; //double x2; }; inline PIByteArray & operator <<(PIByteArray & s, const A & a) {s << a.x1/* << a.x2*/; return s;} inline PIByteArray & operator >>(PIByteArray & s, A & a) {s >> a.x1/* >> a.x2*/; return s;} struct B { B() { x1=0; //x2=0; } B(const B & b) = default; B & operator =(const B & b) {x1=b.x1; return *this;} double x1; //double x2; }; inline PIByteArray & operator <<(PIByteArray & s, const B & a) {s << a.x1/* << a.x2*/; return s;} inline PIByteArray & operator >>(PIByteArray & s, B & a) {s >> a.x1/* >> a.x2*/; return s;} //__PIVECTOR_SIMPLE_TYPE__(B) #include "piconditionvar.h" int main() { PITimeMeasurer tm; PIByteArray ba; ba.reserve(100*100*16); PIVector2D vx; PIVector2D vd; ba << vx; ba >> vx; vd.resize(100, 100); vx = vd; tm.reset(); for(int i=0; i<1000; ++i) { vx.clear(); vx = vd; ba << vx; ba >> vd; } piCout << tm.elapsed_m(); PIVector2D ax; PIVector2D ad; ad.resize(100, 100); ax = ad; tm.reset(); for(int i=0; i<1000; ++i) { ax.clear(); ax = ad; ba << ax; ba >> ad; } piCout << tm.elapsed_m(); PIVector2D bx; PIVector2D bd; bd.resize(100, 100); bx = bd; tm.reset(); for(int i=0; i<1000; ++i) { bx.clear(); bx = bd; ba << bx; ba >> bd; } piCout << tm.elapsed_m(); PIVector2D cx; PIVector2D cd; cd.resize(100, 100); cx = cd; tm.reset(); for(int i=0; i<1000; ++i) { cx.clear(); cx = cd; ba << cx; ba >> cd; } piCout << tm.elapsed_m(); return 0; }