我知道std::vector<T>::emplace_back是干什么的--我也明白为什么我会在push_back()上使用它。它使用各种模板,允许我将多个参数转发给新元素的构造函数。但是我不明白为什么C++标准委员会决定需要一个新的成员函数。为什么他们不能简单地扩展push_back()的功能。据我所见,push_back在C++11中可能重载如下: v
错误在emplace_back行上,不知道如何解决。任何帮助或暗示都将不胜感激,谢谢。matching function for call to ‘std::vector<item_t<3ul> >::emplace_back(<brace-enclosed initializer list/c++/4.8/bits/vector.tcc:91:7: note: void std::vector<_Tp, _Alloc>::
/c++/4.9/bits/vector.tcc:97:40: required from 'void std::vector<_Tp, _Alloc>::emplace_back(_Args&&void obj<value_type>::_emplace_back(vaList_t&& ...)我试图用类型签名调用这个名为emplace_back的向量函数:
template< class
5 }; // invokes whatever became of the original struct initialization but now maybe runs through C+std::vector<X> vx;但不是..。v. 15.7.4
我不理解初始化程序列表、隐式定义(或编译器定义) ctors和转发函数(如emplace_back() )之间的