Removed constexpr from substr() as it doesn't work with BOOST_THROW_EXCEPTION. Added a test for streaming.

[SVN r84518]
This commit is contained in:
Andrey Semashev
2013-05-26 19:23:52 +00:00
parent 547c562464
commit 71b501a0b0
3 changed files with 174 additions and 3 deletions

View File

@@ -25,6 +25,7 @@
#include <algorithm>
#include <iterator>
#include <string>
#include <iosfwd>
namespace boost {
@@ -135,10 +136,7 @@ namespace boost {
// basic_string_ref string operations
BOOST_CONSTEXPR
basic_string_ref substr(size_type pos, size_type n=npos) const {
// Looks like msvc 8 and 9 have a codegen bug when one branch of
// a conditional operator is a throw expression. -EAN 2012/12/04
if ( pos > size())
BOOST_THROW_EXCEPTION( std::out_of_range ( "string_ref::substr" ) );
if ( n == npos || pos + n > size())