variant::variant(const variant& o):vt(o.vt) { switch(vt) { case vt_nil: break; case vt_bool: this->b = o.b; break; case vt_int32: this->n = o.n; break; case vt_uint32: this->un = o.un; break; case vt_int64: this->ll = o.ll; break; case vt_uint64: this->ull = o.ull; break; case vt_float: this->f = o.f; break; case vt_double: this->d = o.d; break; case vt_pointer: this->p = o.p; break; case vt_string: case vt_d_string: { this->vt = vt_nil; const char* s = o; int l = o.length(); this->setbinary(s, l); } break; case vt_table: { this->tab = new CppTable(*o.tab); } break; case vt_object: { memcpy(&this->obj, &o.obj, sizeof(o.obj)); } break; } }