This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] Apply DR434 resolution to <debug/bitset>
Jonathan Wakely wrote:
>I don't know how to do this cleanly in Doug's debug framework.
>This check in string::operator[] needs to test pos < size in pedantic
>mode but pos <= size otherwise:
>
> _GLIBCXX_DEBUG_ASSERT(__pos < size());
>
>Maybe we need something like this
>
>#ifdef _GLIBCXX_DEBUG_PEDANTIC
>#define _GLIBCXX_DEBUG_STRING_ELEMENT_ACCESS(A) \
> _GLIBCXX_DEBUG_ASSERT(__pos < size())
>#else
>#define _GLIBCXX_DEBUG_STRING_ELEMENT_ACCESS(A) \
> _GLIBCXX_DEBUG_ASSERT(__pos <= size())
>#endif
>
>
I think something simpler would also do, since there is only *one*
occurrence, right?
Right in operator[]:
#ifdef _GLIBCXX_DEBUG_PEDANTIC
_GLIBCXX_DEBUG_ASSERT(__pos < size())
#else
_GLIBCXX_DEBUG_ASSERT(__pos <= size())
#endif
???
Paolo.