Value::Value(const Value& other) : Value() { if (other.has_value()) { impl = other.impl->clone(clone_storage()); } }
const Value& Value::operator=( const Value& other) { if (other.has_value()) { impl = other.impl->clone(clone_storage()); } else { if (impl) { impl->~ValueImpl(); impl = nullptr; } } return *this; }
Value::Value(int32_t i) : Value() { impl = new (clone_storage()) BSON::Type (Types::Int32(i)); }
Value::Value(const Key & key) : Value() { impl = new (clone_storage()) BSON::Type (Types::Utf8(key.c_str())); }
Value::Value(const char * str) : Value() { impl = new (clone_storage()) BSON::Type (Types::Utf8(str)); }
Value::Value ( const ValueImpl & i) : Value() { impl = i.clone(clone_storage()); }
ContigStoragePtr Clone(){ ContigStoragePtr clone_storage(new SimpleContigStorage()); for(size_t i = 0; i < storage_.size(); i++) clone_storage->Add(storage_[i]); return clone_storage; }