Boost logo

Boost :

Subject: Re: [boost] std::map<> - like structure for other than std::pair<>?
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2015-04-15 07:46:46


On Wed, Apr 15, 2015 at 1:23 PM, David Hagood <david.hagood_at_[hidden]>
wrote:

> One problem I see with using a set is that the whole data type is used as
> the key - if you do a find you have to supply the whole data type, not just
> the key, even though a custom compare operator may only consider part of
> the object as the key (to use the example use case I gave, you would have
> to supply a whole CF::Property to the find() function, not just the string).
>

See
http://www.boost.org/doc/libs/1_57_0/libs/multi_index/doc/reference/hash_indices.html#lookup
and its concept of Compatible Key.

This does exactly what you want I believe. --DD


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