pibytearray patch, now automatic supports all simple types

This commit is contained in:
2020-10-01 19:04:10 +03:00
parent e474c5a8de
commit 2ca8db70f3
4 changed files with 268 additions and 129 deletions

View File

@@ -2,31 +2,27 @@
struct A {
double x1;
//double x2;
//PIString str;
};
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;}
//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;}
//B & operator =(const B & b) {x1=b.x1; return *this;}
//A aa;
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);
PITimeMeasurer tm;
PIVector2D<double> vx;
PIVector2D<double> vd;
ba << vx;