Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
358B

  1. using System.Runtime.InteropServices;
  2. namespace Svelto.ECS.Hybrid
  3. {
  4. public struct ValueReference<T> where T:class, IImplementor
  5. {
  6. public ValueReference(T obj) { _pointer = GCHandle.Alloc(obj, GCHandleType.Normal); }
  7. public static explicit operator T(ValueReference<T> t) => (T) t._pointer.Target;
  8. GCHandle _pointer;
  9. }
  10. }