初学者关于vector的一个问题


class Solution {
public:
    int totalFruit(vector<int>& tree) {
        int n = tree.size();
        vector<int> count(n);
        int l = 0, r = 0, dif = 0;
        for(r = 0; r < n; r++) {
            if(count[tree[r]]++ == 0) {
                dif++;
            }
            if(dif > 2) {
                if(--count[tree[l++]] == 0) {
                    dif--;
                }
            }
        }
        return r - l;

    }
};

请问代码中的cout[tree[r]]++==0是什么意思,没看明白,还有--cout[tree[l++]]==0