当参数通过引用传递时,为什么复制构造函数调用函数参数?

Jef*_*eff 1 c++

我从Accelerated C++中看到了这个例子

vector<string> func(const string&); //function declaration

vector<string> v;
string line = "abc";

v = func(line); //on entry, initialization of func's single parameter from line
         //on exit, both initialization of the return value and then assignment to v
Run Code Online (Sandbox Code Playgroud)

我的问题是,因为func将const字符串引用作为参数,为什么在输入func时调用了复制构造函数?由于行是通过引用传递的,因此func只是在其本地堆栈上保留对行的引用?

Mat*_*lia 5

在进入时,初始化func的单个参数来自line

func的参数从初始化的line,但它不是a string,而是对它的引用.它的初始化不会导致对复制构造函数的调用,但它会使参数成为别名line(就像初始化引用时一样).