C++ STL でベクトルについて学習しようとしています...
私は次のようなクラスを持っていtempます:
class temp
{
private :
    int a;
public :
    //temp() {}
    temp(int a)
    {
        std::cout<<"ctor called"<<std::endl;
        this->a=a;
    }
    void setA(int a)
    {
        this->a=a;
    }
    int getA()
    {
        return a;
    }
};
さて、主に、私は書きました:
int main() {
    vector<temp> v;
    v.resize(7,temp(5));
    for(int i=0;i<7;i++) {
        v[i].setA(i);
    }
    for(int i=0;i<7;i++) {
        cout<<v[i].getA()<<"\t";
    }
}
私が得た出力は
ctor called
0 1 2 3 4 5 6 
クラス temp の 7 つの異なるオブジェクトを作成しているときに、コンストラクターが 1 回だけ呼び出されたのはなぜですか?