From 90915c5a998c8a58829cf56b4f475cb9773817db Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Wed, 7 Feb 2024 17:04:57 +0000 Subject: [PATCH] Added increment and decrement operators to `LLamaPos` --- LLama/Native/LLamaPos.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/LLama/Native/LLamaPos.cs b/LLama/Native/LLamaPos.cs index 52d67d50..47564d55 100644 --- a/LLama/Native/LLamaPos.cs +++ b/LLama/Native/LLamaPos.cs @@ -35,4 +35,24 @@ public record struct LLamaPos /// /// public static implicit operator LLamaPos(int value) => new(value); + + /// + /// Increment this position + /// + /// + /// + public static LLamaPos operator ++(LLamaPos pos) + { + return new LLamaPos(pos.Value + 1); + } + + /// + /// Increment this position + /// + /// + /// + public static LLamaPos operator --(LLamaPos pos) + { + return new LLamaPos(pos.Value - 1); + } } \ No newline at end of file