更新时间:2022-12-13 23:34:59
特别是因为您使用了初始化器列表使用复制构造函数.初始化程序列表使用对象的副本进行初始化,然后传递给向量.
It's specifically because you use an initializer list that the copy-constructor is used. The initializer list is initialized with a copy of the object, and then passed to the vector.
如果您从C ++ 14中阅读了链接的参考文献,它甚至会明确地说出
If you read the linked reference, from C++14 it even explicitly say
...每个元素都已从原始初始值设定项列表的相应元素中进行了复制初始化 ...
强调地雷