Why std::vector<double> contents are eliminated when passing them by value? : I have an initialized std::vector<double> of size 4 and I am trying to pass it to a function which must perform some sort of calculations on it and return the result.
By debugging I have noticed if I pass the vector by value, as soon as I enter the function the size of the vector becomes 0, whereas the capacity is correctly 4.
In order to understand which is the problem I have written an extremely simple code which has the same identical issue.

    // @main.cpp
    #include "fcn.h"
    int main() {
	    std::vector<int> vect;
	    vect.push_back(0);
	    vect.push_back(1);
	    vect.push_back(2);
        vect.push_back(3);

        // As it should, at this point in the debugger vect.size() == 4
	    printValues(vect);

	    return 0;
    }
    
    
    // @fcn.h
    #include <iostream>
    #include <vector>
    
    using namespace std;
    void printValues(vector<int> vect);


    // @fcn.cpp
    #include "fcn.h"
    void printValues(vector<int> vect) {
        // As soon as I get here, vect.size() == 0
		for (int i = 0; i < vect.size(); i++) 
			std::cout << "vect[" << i << "] = " << vect[i] << endl;
	
    }


I am pretty sure I have done this many times before and I have no idea why it is not working this time. The reason is probably trivial, but I cannot see it. The issue is "solved" only if I pass the vector by reference, but this seems utterly strange to me.

Last but not least, if I try to initialize vect with

    vect = {0, 1, 2, 3};

instead of std::vector.push_back() the debugger tells me that vect has a capacity 4 but size 0. Don't know if this can be of any relevance.