Max size of the vector : I'm trying to read in numbers from a file and take the average of all the numbers but i'm unsure how to include the data.reserve() part into my code. How exactly do I use it to set the maximum size of the vector?

    //   1) Read in the size of the data to be read (use type size_t)
    //   2) Use data.reserve() to set the maximum size of the vector
    //   3) Use a for loop to read in the specified number of values,
    //      storing them into the vector using data.push_back()
    void reserve(vector<int> &data) {
        
        cout << "Using reserve!" << endl;
    
        if (cin){
            size_t max_size;
            //max_size = 12;
            
            data.reserve(max_size);
            cout << "max_size = " << max_size << endl;
            
            for (size_t i = 0; i < max_size; i++){
                cin >> data[i];
                data.push_back(data[i]);
                cout << data[i] << " ";
            }
            
        }