From eb29d71245c17cd82c1afd817ec2b98d85152e88 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 3 May 2022 00:23:10 +0300 Subject: [PATCH] Corrected argument type in string_view/ref::at(). --- include/boost/utility/string_ref.hpp | 2 +- include/boost/utility/string_view.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/utility/string_ref.hpp b/include/boost/utility/string_ref.hpp index 706967d..6e8ecc5 100644 --- a/include/boost/utility/string_ref.hpp +++ b/include/boost/utility/string_ref.hpp @@ -134,7 +134,7 @@ namespace boost { // element access BOOST_CONSTEXPR const charT& operator[](size_type pos) const { return ptr_[pos]; } - const charT& at(size_t pos) const { + const charT& at(size_type pos) const { if ( pos >= len_ ) BOOST_THROW_EXCEPTION( std::out_of_range ( "boost::string_ref::at" ) ); return ptr_[pos]; diff --git a/include/boost/utility/string_view.hpp b/include/boost/utility/string_view.hpp index 2db87f1..30837e4 100644 --- a/include/boost/utility/string_view.hpp +++ b/include/boost/utility/string_view.hpp @@ -128,7 +128,7 @@ namespace boost { // element access BOOST_CONSTEXPR const_reference operator[](size_type pos) const BOOST_NOEXCEPT { return ptr_[pos]; } - BOOST_CONSTEXPR const_reference at(size_t pos) const { + BOOST_CONSTEXPR const_reference at(size_type pos) const { return pos >= len_ ? BOOST_THROW_EXCEPTION(std::out_of_range("boost::string_view::at")), ptr_[0] : ptr_[pos]; }