On Sun, Oct 21, 2007 at 09:43:11PM +0200, Lars Gullik Bjønnes wrote:
> 
> 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;
> }

Looks ok to me.

Andre'

Reply via email to