1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 10:57:34 +00:00

AK: Do bounds checking (assertions) in Span::operator[]

This commit is contained in:
Andreas Kling 2021-02-21 11:30:24 +01:00
parent dae071629f
commit a65f178ce8

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2021, the SerenityOS developers.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -209,11 +209,11 @@ public:
ALWAYS_INLINE constexpr T& operator[](size_t index) const ALWAYS_INLINE constexpr T& operator[](size_t index) const
{ {
return this->m_values[index]; return at(index);
} }
ALWAYS_INLINE constexpr T& operator[](size_t index) ALWAYS_INLINE constexpr T& operator[](size_t index)
{ {
return this->m_values[index]; return at(index);
} }
ALWAYS_INLINE constexpr Span& operator=(const Span<T>& other) ALWAYS_INLINE constexpr Span& operator=(const Span<T>& other)