Jean-Marc Lasgouttes wrote:
Martin Vermeer <[EMAIL PROTECTED]> writes:

Sorry... I don't understand this. What do you mean? What
code does this require?

Something like that (untested)

InsetLayout const & TextClass::insetlayout(docstring const & name) const {
        docstring n = name;
        while (!n.empty()) {
                if (insetlayoutlist_.count(n) > 0)
                        return insetlayoutlist_[n];
                docstring::size_type i = n.rfind(':');
                if (i != string::npos) // delimiter was found
                        n = n.substr(0, i);
                else
                        break;

I personally prefer this style:

                if (i == string::npos)
                        // delimiter was not found
                        break;

                n = n.substr(0, i);
                <more code here>

In general, treat the case that lead to the lesser code first. This avoids indentation for following code.

Abdel.

Reply via email to