Answer the question
In order to leave comments, you need to log in
Creating a vector of C++ arrays? And how to add data there?
Good afternoon. The situation is this.
We have 6 values. In fact, these are the coordinates of 3 points.
I cycle through the curve at a certain interval and write down 3 points. The curve can be of different lengths, so I'm thinking of using a vector.
I'm assuming that 1 element of the vector is an array[6]. Depending on the length of the curve, we create additional vector elements.
How to implement at the moment I have no idea.
I ask for help, I found information on the forums, but unfortunately I did not understand.
Answer the question
In order to leave comments, you need to log in
What arrays, what elements? What will your code tell you in a year or two, when you see an array of six "somethings"?
Why not declare a regular view structure
struct Point { // понятно, что это координаты точки, а не абстрактные буквы в вакууме
double x, y;
};
// имена, конечно, надо заменить на что-то, имеющее отношение к вашей задаче
struct Bundle { // здесь понятно, что это какая-то композиция из трёх точек
Point p1, p2, p3;
};
std::vector<Bundle> v; // а здесь — вектор из этих композиций из трёх точек
// добавляем
v.emplace_back(Bundle{{ 0.0, 0.1},
{0.15, 0.05},
{ 1.0, 0.5}});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question