On 8/21/07, Oliver Kania
Hello,
Hi Oliver,
what I basically want to do is using multi-index like a hashmap. I want to use vector<long> as key. However, all the examples I found are using member-fields of the values or the values themselves as key. Is it not possible to use multi-index like a hash_map
where the key is independent of the value type ? If yes, could someone please provide an example ?
You need Boost.Bimap. Online docs here: http://tinyurl.com/22sja5 Look at "Unconstrained sets" section. It will be included in Boost 1.35, you can check out of svn head now. An example of what you are asking: typedef bimap < vector_of< long >, unconstrained_set_of< something >
bm_type; bm_type bm; assign::push_back( bm ) ( 1, a ) ( 2, b ) ( 3, c ); BOOST_FOREACH( bm_type::left_reference p, bm.left ) { cout << p.first << "-->" << p.second; } King regards Matias