Skip to content

Commit

Permalink
Added increment and decrement operators to LLamaPos
Browse files Browse the repository at this point in the history
  • Loading branch information
martindevans committed Feb 7, 2024
1 parent 82c471e commit 90915c5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LLama/Native/LLamaPos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,24 @@ private LLamaPos(int value)
/// <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);
}
}

0 comments on commit 90915c5

Please sign in to comment.