Add copy and swap tests. Fix wrong return value from copy.

This commit is contained in:
Beman committed 2015-07-14 15:24:11 -04:00
1 parent 9c961f0577
commit 6069151a06
2 files changed
+79 -5

No files matched your search

+3 -1
View File
@@ -158,7 +158,9 @@ namespace boost {
size_type copy( charT* s, size_type n, size_type pos = 0 ) const {
if ( pos > size())
BOOST_THROW_EXCEPTION( std::out_of_range ( "string_view::copy" ) );
return std::copy_n(begin() + pos, (std::min)(n, len_ - pos), s);
size_type rlen = (std::min)(n, len_ - pos);
std::copy_n(begin() + pos, rlen, s);
return rlen;
}
BOOST_CONSTEXPR basic_string_view substr(size_type pos, size_type n=npos) const {