Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-03-01 15:20:28


AMDG

Olaf Peter wrote:
> Hi,
>
> the snipped attached counts the accourance of a specified character.
> Is there a simpler way using the boost libs? This solution looks quite
> overkill. It should be fast ;-)

If you only want one character the standard library is enough:
std::count(str1.begin(), str1.end(), ' ')

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net