John Reid ha escrito:
Travis Parks wrote:
I have always been interested in a data structure for storing pairs of of keys. In math it is a one-to-one mapping. I find it useful from time to time to have a container that allows me to treat it like an enum, but then to do the operation the other way. I usually do it lazily and just do a map and then do a linear search for the value when I need to.
Look at http://www.boost.org/libs/multi_index/doc/index.html this does all you want.
Also, there's the more specific Boost.Bimap library (accepted some weeks ago) for explicitly constructing bidirectional mapping structures: http://cablemodem.fibertel.com.ar/mcape/oss/projects/mc_projects/boost_proje... Joaquín M López Muñoz Telefónica, Investigación y Desarrollo