8
C ++ 11 emplace_back pada vektor <struct>?
Pertimbangkan program berikut: #include <string> #include <vector> using namespace std; struct T { int a; double b; string c; }; vector<T> V; int main() { V.emplace_back(42, 3.14, "foo"); } Tidak berhasil: $ g++ -std=gnu++11 ./test.cpp In file included from /usr/include/c++/4.7/x86_64-linux-gnu/bits/c++allocator.h:34:0, from /usr/include/c++/4.7/bits/allocator.h:48, from /usr/include/c++/4.7/string:43, from ./test.cpp:1: /usr/include/c++/4.7/ext/new_allocator.h: In instantiation of …