Andre Poenitz wrote:
> On Fri, Nov 01, 2002 at 04:32:14PM +0000, Angus Leeming wrote:
>> Andr�, I have a warning when compiling math_data.C. Wouldn't it be more
>> elegant/comprehensible to define a MathCursor::npos if you're saying that
>> the value is now invalid?
>
> Why not. Apply it if you want (I am off now for the weekend).
>
> Andre'
I won't do that because I'm not at all sure that this code is safe if it
receives
size = (size_type)-1;
Should you not add a test that size is valid? What should you do if it
isn't?
Angus
void MathCursor::adjust(pos_type from, size_type size)
{
if (cursor().pos_ > from)
cursor().pos_ += size;
if (Anchor_.back().pos_ > from)
Anchor_.back().pos_ += size;
// just to be on the safe side
// theoretically unecessary
normalize();
}