Boost logo

Boost :

Subject: Re: [boost] [intrusive] advanced lookup/insertion suggestion
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2012-02-15 06:01:25


El 15/02/2012 0:27, Rei Thiessen escribió:
> // library
> template<typename ElementType, typename KeyType>
> struct element_key_info
> {};
>
> // different name to avoid overload confusion.
> // instantiation succeeds only when
> // element_key_info is properly specialized
> template<typename KeyType>
> iterator unordered_set::find_key( KeyType const& k )
> {...}
> // user
> namespace intrusive{
> template<>
> struct element_key_info<element_type,key_type>
> {
> typedef key_hash hash_type;
> typedef key_equality equality_type;
> };
> }

Then for an element we have only one possible hash and comparison type,
and that's not acceptable. A user might want to use a better hash
function or just compare some set fields for equality but not all of them.

Ion


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