mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Allow string_view::at() to be constexpr again on VS2015
VS2015 doesn't support extended constexpr. Thanks to Lastique for the ternary trick
This commit is contained in:
parent
38b536ff05
commit
38121f2af3
@ -121,13 +121,7 @@ namespace boost {
|
||||
BOOST_CONSTEXPR const_reference operator[](size_type pos) const BOOST_NOEXCEPT { return ptr_[pos]; }
|
||||
|
||||
BOOST_CONSTEXPR const_reference at(size_t pos) const {
|
||||
#ifndef _MSC_VER
|
||||
return pos >= len_ ? BOOST_THROW_EXCEPTION(std::out_of_range("boost::string_view::at")) : ptr_[pos];
|
||||
#else
|
||||
if (pos >= len_)
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("boost::string_view::at"));
|
||||
return ptr_[pos];
|
||||
#endif
|
||||
return pos >= len_ ? BOOST_THROW_EXCEPTION(std::out_of_range("boost::string_view::at")), ptr_[0] : ptr_[pos];
|
||||
}
|
||||
|
||||
BOOST_CONSTEXPR const_reference front() const { return ptr_[0]; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user