I don't think there is any predefined function for such a rather specialized task.
And I don't see what difference it really makes whether you have the names of the entries to look for.
The basic algorithm is however really easy:
- Create a
std::map<int, int>
, containing as key each value you are interested in, and as value a 0 (that will be the count of such values in the end) - Read each line of the file
- If the line doesn't start with a
[
and contains a=
- extract the part between the
=
and line end. - find the entry with the extracted part as key in the map
- increase the count for that key
- extract the part between the