48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#include "pip.h"
|
|
#include "pivariantsimple.h"
|
|
|
|
#pragma pack(push, 1)
|
|
struct MM {
|
|
int x;
|
|
int x2;
|
|
double y;
|
|
char c[16];
|
|
int e2;
|
|
int e;
|
|
//PIPointd h;
|
|
};
|
|
#pragma pack(pop)
|
|
|
|
int Acnt = 0;
|
|
|
|
class A {
|
|
public:
|
|
A() {moved = false; i = "constructor"; piCout << "A()"; ++Acnt;}
|
|
A(const PIString & s): i(s) {moved = false; piCout << "A(String)"; ++Acnt;}
|
|
A(const A & a): i(a.i) {moved = false; piCout << "copy A(&)"; ++Acnt;}
|
|
A(A && a): i(std::move(a.i)) {moved = false; a.moved = true; piCout << "copy A(&&)"; ++Acnt;}
|
|
~A() {piCout << "~A()" << moved; --Acnt;}
|
|
void swap(A & a) {piCout << "swap A()"; piSwap(i, a.i);}
|
|
A & operator =(const A & a) {i = a.i; piCout << "= A&"; return *this;}
|
|
A & operator =(A && a) {piSwap(i, a.i); a.moved = true; piCout << "= A&&)"; return *this;}
|
|
bool operator ==(const A & a) {return true;}
|
|
PIString i;
|
|
bool moved;
|
|
MM m;
|
|
static void F(int) {}
|
|
};
|
|
|
|
inline PIByteArray & operator <<(PIByteArray & ba, const A & v) {ba << v.i << v.m; return ba;}
|
|
inline PIByteArray & operator >>(PIByteArray & ba, A & v) {ba >> v.i >> v.m; return ba;}
|
|
|
|
inline PIByteArray & operator <<(PIByteArray & ba, const MM & v) {piCout << "<<"; ba << v.x << v.y << v.c; return ba;}
|
|
inline PIByteArray & operator >>(PIByteArray & ba, MM & v) {piCout << ">>"; ba >> v.x >> v.y >> v.c; return ba;}
|
|
|
|
|
|
int main() {
|
|
PIMathVectorT3d v3 = createVectorT3d(1,2,3);
|
|
PIMathVectord v(v3);
|
|
piCout << v;
|
|
return 0;
|
|
}
|