mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-19 16:40:26 +02:00
Dynamic boxing
This commit is contained in:
parent
7036433e5d
commit
da5b81f419
14 changed files with 266 additions and 151 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue