加个b.emplace_back() 试试。
其实vector<float[4]>也是有问题的,只是编译器没有诊断。对于vector<T>:
The requirements that are imposed on the elements depend on the actual operations performed on the container. Generally, it is required that element type is a complete type and meets the requirements of Erasable, but many member functions impose stricter requirements.
其中的Erable:
All standard library containers require that their element type satisfies Erasable.
With the default allocator, this requirement is equivalent to the validity of p->~T(), which accepts class types with accessible destructors and all scalar types, but rejects array types, function types, reference types, and void.
这里明确说了:拒绝数组类型。
【 在 capriccio 的大作中提到: 】
: std::vector<float[4]> b;
: std::list<float[4]> s;
: 去掉第二行就可以编译通过,运行的数据也都对。
: ...................
--
FROM 209.249.20.*