Consider the following example of a simple class implementation in C++.
foo.hpp
#include <vector>
class Foo {
private:
std::vector<double> X;
public:
Foo() = default;
~Foo() = default;
Foo(std::vector<double>&);
};
foo.cpp
#include "Foo.hpp"
Foo::Foo(std::vector<double>& X):
X(X)
{}
In this case, the vector X is passed by reference to the constructor of the class Foo. I start having doubts, though, on whether the operation X(X) in the implementation makes a copy and pastes it "in" the member X of the class.
Which is it?