samedi 11 mars 2017

default value in C++ container library

I saw some code

    unordered_map<int, int> table;
    for (int i = 0; i < nums1.size(); i++) {
        table[nums1[i]]++;
    }

nums1 is input vector array, I know the value of pair is the occurrence of entry in nums1 My question is default value of table[nums[i]] is alway 0 ?? just like default value of a local int variable ?

Aucun commentaire:

Enregistrer un commentaire