c++ - Covering 2D space with 1D sequence -


i want make structure storing value 2 keys - 'x' , 'y'. thought use std::map>. think better use 1 std::map , combine both keys 1 key (i call 'p').

so need function p->(x,y) , function (x,y)->p. both 'x' , 'y' integer types negative values allowed.

i think should possible surprised did not find tons of articles on internet.

i have ideas how it, seems complicated. please give me advices how or topics read problematics?

example of possible mapping (but need mathematical form of that): http://i.stack.imgur.com/ubvam.png

thank advices :-)

i use std::map<std::tuple<int,int>, int> example, tuple (x,y) , value z. otherwise difficult keep 1-to-1 mapping of p(x,y) z.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -