Hi I am trying to write a function which reads data from a file and then saves it in memory.
This memory will need a x and a y value to be identified. It may not be linear, there can be big jumps between the different x and y values and the amount of values are unknown which excludes the use of an multi-dimensional array.
I wanted to use std::map since it does what I need, but it does not support multiple key values. What else could I use to store the data or is there a way to merge the X and Y values so that it will be able to be used in a map container?
Make a pair of the
xandyvalues, and use that as the key:Note that as it stands, this will treat the
xvalues as more significant than theyvalues if you traverse the map in order. If you want theyvalues to be more significant, you’d want to put them first in the pair.