Specialize gsl::at for span
span being a view and not a container, the generic version of gsl::at is not valid any more for span.
This commits adds a specialization of gsl::at for span
diff --git a/gsl/span b/gsl/span
index 1dc4600..7ba3f3d 100644
--- a/gsl/span
+++ b/gsl/span
@@ -653,6 +653,14 @@
return {reinterpret_cast<byte*>(s.data()), s.size_bytes()};
}
+// Specialization of gsl::at for span
+template <class ElementType, std::ptrdiff_t Extent>
+constexpr ElementType& at(const span<ElementType ,Extent>& s, size_t index)
+{
+ // No bounds checking here because it is done in span::operator[] called below
+ return s[index];
+}
+
} // namespace gsl
#ifdef _MSC_VER