Files
RobustToolbox/Robust.Shared/Utility/Ptr.cs
Pieter-Jan Briers 2783e89d1f SDL2 windowing backend (#2979)
* SDL2 windowing prototype.

* More stuff idk
2022-07-15 00:07:30 +10:00

14 lines
416 B
C#

namespace Robust.Shared.Utility;
/// <summary>
/// Pointer-wrapper struct so pointers can be sanely stored in generics and records.
/// </summary>
/// <typeparam name="T">The actual type pointed to</typeparam>
internal unsafe struct Ptr<T> where T : unmanaged
{
public T* P;
public static implicit operator T*(Ptr<T> t) => t.P;
public static implicit operator Ptr<T>(T* ptr) => new() { P = ptr };
}