tôi khởi vectơ bình thường kiểu như thế này:Khởi tạo vector struct với cú đúp kín danh sách initializer
vector<float> data = {0.0f, 0.0f};
Nhưng khi tôi sử dụng cấu trúc thay vì bình thường kiểu
struct Vertex
{
float position[3];
float color[4];
};
vector<Vertex> data = {{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}};
tôi nhận được lỗi could not convert '{{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}}' from '<brace-enclosed initializer list>' to 'std::vector<Vertex>'
. Chuyện gì thế này?