diff options
author | ericLemanissier <eric.lemanissier@gmail.com> | 2016-08-23 10:30:06 +0200 |
---|---|---|
committer | ericLemanissier <eric.lemanissier@gmail.com> | 2016-08-23 12:18:36 +0200 |
commit | 134f2db5d9c9039b04cb2da1513c7ffdd7906fb8 (patch) | |
tree | 425802ddfa631a034185ae91eba07a727d3c0248 /gsl/span | |
parent | 93b3258e3688298278a43ba583cc08b856a4c615 (diff) | |
download | platform_external_Microsoft-GSL-134f2db5d9c9039b04cb2da1513c7ffdd7906fb8.tar.gz platform_external_Microsoft-GSL-134f2db5d9c9039b04cb2da1513c7ffdd7906fb8.tar.bz2 platform_external_Microsoft-GSL-134f2db5d9c9039b04cb2da1513c7ffdd7906fb8.zip |
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
Diffstat (limited to 'gsl/span')
-rw-r--r-- | gsl/span | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -653,6 +653,14 @@ as_writeable_bytes(span<ElementType, Extent> s) noexcept 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 |