Unstable 0.15.15.0 (and the one before it I forgor)
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
public struct Range<T> where T : IComparable
|
||||
/// <summary>
|
||||
/// An inclusive range, i.e. [Start, End] where Start <= End
|
||||
/// </summary>
|
||||
public struct Range<T> where T : notnull, IComparable<T>
|
||||
{
|
||||
private T start; private T end;
|
||||
public T Start
|
||||
@@ -25,6 +29,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(in T v)
|
||||
=> start.CompareTo(v) <= 0 && end.CompareTo(v) >= 0;
|
||||
|
||||
private void VerifyStartLessThanEnd()
|
||||
{
|
||||
if (start.CompareTo(end) > 0) { throw new InvalidOperationException($"Range<{typeof(T).Name}>.Start set to a value greater than End ({start} > {end})"); }
|
||||
|
||||
Reference in New Issue
Block a user