From fb1243d735d683c59164940b732ae6fa21a3da01 Mon Sep 17 00:00:00 2001 From: Werner Henze Date: Sun, 19 Apr 2020 16:41:12 +0200 Subject: [PATCH] suppress code analysis warning - suppress " warning C26481: Don't use pointer arithmetic. Use span instead (bounds.1)." - Please note that the suppression in `end()` does not work with MSVC 16.5.4. --- include/gsl/span | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/gsl/span b/include/gsl/span index c011d76..1025870 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -582,12 +582,18 @@ public: constexpr iterator begin() const noexcept { const auto data = storage_.data(); + // clang-format off + GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute + // clang-format on return {data, data + size(), data}; } constexpr iterator end() const noexcept { const auto data = storage_.data(); + // clang-format off + GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute + // clang-format on const auto endData = data + storage_.size(); return {data, endData, endData}; }