From cebae5c4e159a1963f371962cd515886b8b2e995 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 17 Oct 2023 09:53:48 +0200 Subject: [PATCH] Add `foreach` loop support to `Span` type --- Source/Engine/Core/Types/Span.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Source/Engine/Core/Types/Span.h b/Source/Engine/Core/Types/Span.h index e0518ec77..b51c858ec 100644 --- a/Source/Engine/Core/Types/Span.h +++ b/Source/Engine/Core/Types/Span.h @@ -107,6 +107,26 @@ public: ASSERT(index >= 0 && index < _length); return _data[index]; } + + FORCE_INLINE T* begin() + { + return _data; + } + + FORCE_INLINE T* end() + { + return _data + _length; + } + + FORCE_INLINE const T* begin() const + { + return _data; + } + + FORCE_INLINE const T* end() const + { + return _data + _length; + } }; template