1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-19 16:40:26 +02:00

Dynamic boxing

This commit is contained in:
Brian Fiete 2020-09-14 11:18:24 -07:00
parent 7036433e5d
commit da5b81f419
14 changed files with 266 additions and 151 deletions

View file

@ -296,6 +296,22 @@ namespace System
return *(T*)(void*)mData;
}
public Result<Object> GetBoxed()
{
if (IsObject)
return .Err;
var type = VariantType;
var boxedType = type.BoxedType;
if (boxedType == null)
return .Err;
var self = this;
var object = Try!(boxedType.CreateObject());
Internal.MemCpy((uint8*)Internal.UnsafeCastToPtr(object) + boxedType.[Friend]mMemberDataOffset, self.DataPtr, type.Size);
return object;
}
/*public void Get<T>(ref T val)
{
if (VariantType != typeof(T))