From 405d98f4a74350adc50125b627d614760a619211 Mon Sep 17 00:00:00 2001 From: wvpm <24685035+wvpm@users.noreply.github.com> Date: Fri, 15 May 2026 19:51:03 +0200 Subject: [PATCH] Add [[nodiscard]] for TypedSpan and minor cleanup --- src/openvic-simulation/types/TypedSpan.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openvic-simulation/types/TypedSpan.hpp b/src/openvic-simulation/types/TypedSpan.hpp index 5e58fbdac..6c01cc073 100644 --- a/src/openvic-simulation/types/TypedSpan.hpp +++ b/src/openvic-simulation/types/TypedSpan.hpp @@ -9,7 +9,7 @@ namespace OpenVic { template< - derived_from_specialization_of IndexType, + is_strongly_typed IndexType, typename ValueType, size_t _Extent = std::dynamic_extent > @@ -17,16 +17,16 @@ namespace OpenVic { public: using forwardable_span::forwardable_span; - constexpr IndexType size() const { + [[nodiscard]] constexpr IndexType size() const { return IndexType(forwardable_span::size()); } - constexpr forwardable_span::reference operator[](const IndexType _Off) const { - assert(_Off < size()); - return forwardable_span::operator[](static_cast(type_safe::get(_Off))); + [[nodiscard]] constexpr forwardable_span::reference operator[](const IndexType index) const { + assert(index < size()); + return forwardable_span::operator[](static_cast(type_safe::get(index))); } - constexpr operator TypedSpan() { + [[nodiscard]] constexpr operator TypedSpan() const { return TypedSpan{*this}; } };