Hi everyone,
I used STL map in my code and I am wondering is the associate data automatically initialized or not. The reason I am asking is that I have two arrays of data, and the first array is index, and second array is my data corresponding to the index. But there are duplicate indexs and I want to add up the data of duplicate index.
For example;
map<int index, double data> mid;
mid[index] += data;
So I want to know at beginning, is the data are initialized to 0. or I have to do it myself? Thanks in advance.
Jingbin
I used STL map in my code and I am wondering is the associate data automatically initialized or not. The reason I am asking is that I have two arrays of data, and the first array is index, and second array is my data corresponding to the index. But there are duplicate indexs and I want to add up the data of duplicate index.
For example;
map<int index, double data> mid;
mid[index] += data;
So I want to know at beginning, is the data are initialized to 0. or I have to do it myself? Thanks in advance.
Jingbin
Comment