From 5e198e99832586c74872a14f8da8346aaf117385 Mon Sep 17 00:00:00 2001 From: neargye Date: Thu, 31 Oct 2019 14:10:59 +0500 Subject: [PATCH] update assert --- include/nameof.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nameof.hpp b/include/nameof.hpp index eb4d79d..0e67571 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -146,9 +146,9 @@ class [[nodiscard]] cstring { [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } - [[nodiscard]] constexpr const_reference operator[](std::size_t i) const noexcept { return assert(i < N), chars_[i]; } + [[nodiscard]] constexpr const_reference operator[](std::size_t i) const noexcept { return assert(i < size()), chars_[i]; } - [[nodiscard]] constexpr const_reference at(std::size_t i) const { return assert(i < N), chars_.at(i); } + [[nodiscard]] constexpr const_reference at(std::size_t i) const { return assert(i < size()), chars_.at(i); } [[nodiscard]] constexpr const_reference front() const noexcept { return chars_[0]; }