Commit 261b8cc8 authored by Ronan's avatar Ronan
Browse files

feat(Variant): add copy constructor impl

parent d09232f3
......@@ -66,7 +66,18 @@ Variant::Variant (Type type) : Variant() {
}
Variant::Variant (const Variant &src) {
// TODO.
// Don't call placement new.
L_ASSERT(!mPrivate);
mPrivate = new VariantPrivate();
L_D(Variant);
d->type = src.getPrivate()->type;
const VariantPrivate::Value &value = src.getPrivate()->value;
if (d->type == String)
d->value.str = new string(*value.str);
else
d->value = value;
}
Variant::Variant (Variant &&src) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment