add more assert

This commit is contained in:
neargye 2019-10-24 16:17:58 +05:00
parent d293613b62
commit e831936fbe

View file

@ -146,9 +146,9 @@ class [[nodiscard]] cstring {
[[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); }
[[nodiscard]] constexpr const_reference operator[](std::size_t i) const noexcept { return chars_[i]; } [[nodiscard]] constexpr const_reference operator[](std::size_t i) const noexcept { return assert(i < N), chars_[i]; }
[[nodiscard]] constexpr const_reference at(std::size_t i) const { return chars_.at(i); } [[nodiscard]] constexpr const_reference at(std::size_t i) const { return assert(i < N), chars_.at(i); }
[[nodiscard]] constexpr const_reference front() const noexcept { return chars_[0]; } [[nodiscard]] constexpr const_reference front() const noexcept { return chars_[0]; }