Boost logo

Boost :

Subject: Re: [boost] std::map<> - like structure for other than std::pair<>?
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2015-04-14 08:01:50


On Tue, Apr 14, 2015 at 4:26 AM, David Hagood <david.hagood_at_[hidden]>
wrote:

> Several times I have run into a use case where I have some object that I
> would like to access via something like a std::map<>, but which already
> contains a member that I would like to use as a key. Is there any data
> structure that "acts like a map", but instead of storing
> std::pair<key,value> allows me to store an object directly, and specify
> what member of that object is the key value?
>

You want Boost.MultiIndex:
http://www.boost.org/doc/libs/release/libs/multi_index/doc/index.html


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk