Does this look correct?
[The #if0 vs. else parth]

WriteStream & operator<<(WriteStream & ws, docstring const & s)
{
        if (ws.pendingSpace() && s.length() > 0) {
                if (isAlphaASCII(s[0]))
                        ws.os() << ' ';
                ws.pendingSpace(false);
        }
        ws.os() << s;
#if 0
        int lf = 0;
        docstring::const_iterator dit = s.begin();
        docstring::const_iterator end = s.end();
        for (; dit != end; ++dit)
                if ((*dit) == '\n')
                        ++lf;
#else
        int lf = std::count(s.begin(), s.end(), char_type('\n'));
#endif
        ws.addlines(lf);
        return ws;
}

-- 
        Lgb

Reply via email to