Files
RobustToolbox/Robust.Shared.Utility/Utility/Ptr.cs
PJB3005 b7a3526131 Move RHI to its own project
Move some of Robust.Shared to a new project so it can be depended upon without adding longer dependency chains.
2025-10-07 18:18:48 +02: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 };
}