Merge pull request #501 from martindevans/LLamaPos_inc_dec
Added increment and decrement operators to `LLamaPos`
This commit is contained in:
commit
859160d6f7
|
@ -35,4 +35,24 @@ public record struct LLamaPos
|
|||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static implicit operator LLamaPos(int value) => new(value);
|
||||
|
||||
/// <summary>
|
||||
/// Increment this position
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public static LLamaPos operator ++(LLamaPos pos)
|
||||
{
|
||||
return new LLamaPos(pos.Value + 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Increment this position
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public static LLamaPos operator --(LLamaPos pos)
|
||||
{
|
||||
return new LLamaPos(pos.Value - 1);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue