I am having images which are having two numbers for x and y position. I am going to merge these images together as you would do on a grid or on a map. In my code I can get the x and y values.
Mentally my design is not using 2 dimensions - I am using 1D container for strings:
static std::vector<std::string> Files; // source file(s)
Later when I parse the file name and I save the filename to the container:
src.Files.push_back(search_data.cFileName);
The problem is that I did not save the x and y value, which would mean I would need to parse the name later to merge the images in grid... So to enhance it I need to use some kind of container.
My idea is that I could save the x and y value like this arr[x][y]=filename;
however, I need a type because I must insert it into the vector. So I need 2D type of array. To use store it like:
static std::vector<2DArrType> Files; // source file(s)
All I have found till now is this link:
http://stackoverflow.com/questions/936687/how-do-i-declare-a-2d-array-in-c-using-new
which does not uses type, but it creates the arrays. Should I create a class which will have constructor to allocate memory in similar way, and destructor to deallocate it, or is there some more professional way, which is used for cases like that? It would look strange if there would not be type or container to solve this problem (ain't it strange to create class, constructor for allocation and destructor for deallocation every time I need to create 2D container like this?).