std::array<tri*, 128> triangles;
triangles[0] = new tri {
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f
};
...
for (tri* i : triangles) {
// Only pass if the variable exists
if (i) {
std::cout << i->aX; // << it segfaults here
}
}
Thanks for any help
EDIT:
std::cout << triangles.size() << std::endl; returns 128 even before the initialization of the first element *scratches head*