I'm translating a part of code from C# to C++.
Here is the point I am :
Class Point
{
public int X;
public int Y;
}
const int MAX = 256;
public void ComputePoints(Byte[] image,
int width,
int height,
out List<Point>[] listPixels)
{
listPixels = new List<Point>[MAX];
//etc..
}
(I simplified this piece of code to only show interesting part).
My Question concern the out List<Point>[] listPixels. I've try to translate this by :
public void ComputePoints(unsigned char[] image,
int width,
int height,
std::vector<Point> *listPixels[])
{
*listPixels = new std::vector<Point>[MAX];
//etc..
}
But I have error
Segmentation fault.
How can I write the simplest equivalent to out List<Point>[] listPixels in C++ ?
std::vector< std::list< Point> > myVectorOfLists;I would use a vector.List(orstd::vector) - why not just have aList<List(orstd::vector<std::vector)?std::array,std::vector, etc.).