Work around GCC 4.x constexpr failure in operator[]

This commit is contained in:
Peter Dimov
2024-11-04 12:59:39 +02:00
parent 79ca787bfe
commit 9d6b871972

View File

@ -31,7 +31,8 @@
#ifndef BOOST_ARRAY_HPP
#define BOOST_ARRAY_HPP
#include <boost/detail/workaround.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(push)
@ -50,9 +51,6 @@
#include <boost/throw_exception.hpp>
#include <algorithm>
// FIXES for broken compilers
#include <boost/config.hpp>
namespace boost {
@ -117,7 +115,10 @@ namespace boost {
return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i];
}
BOOST_CONSTEXPR const_reference operator[](size_type i) const
#if !BOOST_WORKAROUND(BOOST_GCC, < 50000)
BOOST_CONSTEXPR
#endif
const_reference operator[](size_type i) const
{
return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i];
}