Michael Gerz wrote:
int Paragraph::Pimpl::eraseChars(pos_type start, pos_type end, bool
trackChanges)
{
BOOST_ASSERT(start >= 0 && start <= size());
BOOST_ASSERT(end > start && end <= size() + 1);
I check for end > start, because the caller of eraseChars may
mistakenly assume that end is the last char (but in fact end - 1 is).
However, it turns out that eraseChar() is called by CutAndPaste.C
without a prior check whether there is actually a character to delete
(e.g. start and end are both 0).
What shall I do? Loosen the above assertion (end >= start) or surround
several calls to eraseChars by if(...) statements?
Since nobody seems to have a strong opinion on this issue, I am going to
loosen the assertion (which looks reasonable after a few hours of sleep
:-) )
Michael