
10 Jan
2013
10 Jan
'13
5:19 p.m.
constexpr const_reference operator[]( size_type i ) const { return BOOST_CONSTEXPR_ASSERT( i < size(), elems[i] ); }
The following, more intuitive, might also work: constexpr const_reference operator[]( size_type i ) const { return BOOST_ASSERT(i < size()), elems[i]; } There was some disagreement about the comma expression, but it looks like it's allowed. Most definitions of `assert` (to which BOOST_ASSERT maps usually) should also be fine, even though this is not presently guaranteed by the standard. BOOST_ASSERT_MSG does not depend on the definition of `assert` at all, so it should also work.