===================================================================
@@ -117,7 +117,7 @@
constexpr basic_string_view(const _CharT* __str, size_type __len)
: _M_len{__str == nullptr ? 0 :__len},
- _M_str{__str == nullptr || __len == 0 ? _S_empty_str : __str}
+ _M_str{__str == nullptr ? _S_empty_str : __str}
{ }
basic_string_view&
@@ -277,11 +277,11 @@
constexpr basic_string_view
substr(size_type __pos, size_type __n=npos) const
{
- return __pos < this->_M_len
+ return __pos <= this->_M_len
? basic_string_view{this->_M_str + __pos,
std::min(__n, size_type{this->_M_len - __pos})}
- : (__throw_out_of_range_fmt(__N("basic_string_view::at: __pos "
- "(which is %zu) >= this->size() "
+ : (__throw_out_of_range_fmt(__N("basic_string_view::substr: __pos "
+ "(which is %zu) > this->size() "
"(which is %zu)"),
__pos, this->size()), basic_string_view{});
}
===================================================================
@@ -63,11 +63,9 @@
{
str02 = str01.substr(csz01);
VERIFY( str02.size() == 0 );
+ VERIFY( str02.begin() == str01.end() );
+ VERIFY( true );
}
- catch(std::out_of_range& fail)
- {
- VERIFY( true ); // No terminating null in basic_string_view
- }
catch(...)
{
VERIFY( false );
===================================================================
@@ -63,11 +63,9 @@
{
str02 = str01.substr(csz01);
VERIFY( str02.size() == 0 );
+ VERIFY( str02.begin() == str01.end() );
+ VERIFY( true );
}
- catch(std::out_of_range& fail)
- {
- VERIFY( true ); // No terminating null in basic_string_view
- }
catch(...)
{
VERIFY( false );