Andre Poenitz <[EMAIL PROTECTED]> writes:

| Does this Assert and the error message trigger often nowadays?
>
|       Paragraph::value_type Paragraph::getChar(pos_type pos) const
|       {
|               // This is in the critical path!
|               pos_type const siz = text_.size();
>
|               BOOST_ASSERT(pos <= siz);
>
|               if (pos == siz) {
|                       lyxerr << "getChar() on pos " << pos << " in par id "
|                                                << id() << " of size " << siz
|                                                << "  is a bit silly !" << endl;
|                       return '\0';
|               }
>
|               return text_[pos];
|       }
>
| if not, I'd like to replace this with an inlined
>
|       Paragraph::value_type Paragraph::getChar(pos_type pos) const
|       {
|               text_.at(pos);
|       }

Be careful now.... remember that the standard dictates different
return values for [] (not quite sure about at)

test_[] depending on const or not.

A lot safer to put an assert there and just use [] instead of at.

-- 
        Lgb

Reply via email to