Rework of memory handling in Evaluation
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -34,8 +34,8 @@ namespace Porygon::UserData {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
inline shared_ptr<const EvalValue> Clone() const final {
|
||||
return make_shared<UserDataValue>(_userData, _obj);
|
||||
inline Evaluation::EvalValue* Clone() const final {
|
||||
return new UserDataValue(_userData, _obj);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
@@ -43,22 +43,23 @@ namespace Porygon::UserData {
|
||||
return reinterpret_cast<intptr_t>(_obj);
|
||||
}
|
||||
|
||||
shared_ptr<const EvalValue> IndexValue(const EvalValue *val) const final {
|
||||
const Evaluation::EvalValue* IndexValue(const EvalValue *val) const final {
|
||||
auto fieldId = val->GetHashCode();
|
||||
auto field = _userData->GetField(fieldId);
|
||||
return shared_ptr<const EvalValue>(field->Get(_obj));
|
||||
return field->Get(_obj);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
inline shared_ptr<const EvalValue> IndexValue(uint32_t hash) const final {
|
||||
inline const EvalValue* IndexValue(uint32_t hash) const final {
|
||||
auto field = _userData->GetField(hash);
|
||||
return shared_ptr<const EvalValue>(field->Get(_obj));
|
||||
return field->Get(_obj);
|
||||
}
|
||||
|
||||
void SetIndexValue(const EvalValue *key, const shared_ptr<const EvalValue> &value) const final {
|
||||
void SetIndexValue(const EvalValue *key, const EvalValue* value) const final {
|
||||
auto fieldId = key->GetHashCode();
|
||||
auto field = _userData->GetField(fieldId);
|
||||
field->Set(_obj, value.get());
|
||||
field->Set(_obj, value);
|
||||
delete value;
|
||||
}
|
||||
|
||||
inline void* GetObjectPointer(){
|
||||
|
||||
Reference in New Issue
Block a user