|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81711 - trunk/boost/algorithm
From: marshall_at_[hidden]
Date: 2012-12-04 17:12:47
Author: marshall
Date: 2012-12-04 17:12:47 EST (Tue, 04 Dec 2012)
New Revision: 81711
URL: http://svn.boost.org/trac/boost/changeset/81711
Log:
Fix a regression failure on MSVC 8 and 9; thanks to Eric Niebler for the fix
Text files modified:
trunk/boost/algorithm/string_ref.hpp | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
Modified: trunk/boost/algorithm/string_ref.hpp
==============================================================================
--- trunk/boost/algorithm/string_ref.hpp (original)
+++ trunk/boost/algorithm/string_ref.hpp 2012-12-04 17:12:47 EST (Tue, 04 Dec 2012)
@@ -16,6 +16,7 @@
#define BOOST_STRING_REF_HPP
#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
#include <stdexcept>
#include <algorithm>
@@ -144,11 +145,16 @@
// basic_string_ref string operations
BOOST_CONSTEXPR
basic_string_ref substr(size_type pos, size_type n=npos) const {
-// if ( pos > size()) throw std::out_of_range ( "string_ref::substr" );
-// if ( n == npos || pos + n > size()) n = size () - pos;
-// return basic_string_ref ( data() + pos, n );
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
+ // 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()) throw std::out_of_range ( "string_ref::substr" );
+ if ( n == npos || pos + n > size()) n = size () - pos;
+ return basic_string_ref ( data() + pos, n );
+#else
return pos > size() ? throw std::out_of_range ( "string_ref::substr" ) :
basic_string_ref ( data() + pos, n == npos || pos + n > size() ? size() - pos : n );
+#endif
}
int compare(basic_string_ref x) const {
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk