| 168 | namespace cppcheck { |
| 169 | template<typename T> |
| 170 | std::size_t count_all_of(const std::string& str, T sub) { |
| 171 | std::size_t n = 0; |
| 172 | std::string::size_type pos = 0; |
| 173 | while ((pos = str.find(sub, pos)) != std::string::npos) { |
| 174 | ++pos; |
| 175 | ++n; |
| 176 | } |
| 177 | return n; |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | /* designated initialization helper |