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]>

> 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:

Boost list run by bdawes at, gregod at, cpdaniel at, john at