|
Boost : |
Subject: Re: [boost] [UUID] Still alive?
From: Andy Tompkins (atompkins_at_[hidden])
Date: 2008-09-18 23:06:02
On Thu, 18 Sep 2008 01:26:27 +0200, "Manuel Fiorelli"
<manuel.fiorelli_at_[hidden]> said:
> Since UUIDs are generally used to identify resources, it could be that
> someone wants to instantiate Boost.Unordered with UUID. I don't know
> exectly what are the requirements for the type parameter of
> Boost.Unorder, but I hope that most of them are yet met by UUID.
> Surely it is necessary to extend Boost.Hash, but according to <
> http://www.boost.org/doc/libs/1_36_0/doc/html/hash/custom.html> this
> can be done defining a free function without any explicit coupling
> with Boost.Unordered/Hash.
>
> Summarizing the support for Boost.Hash/Unorded should be a zero-cost
> addition which should't cause the inclusion of no headers from those
> libraries.
>
> Best regards, Manuel Fiorelli
I will add support for this (without including
boost\functional\hash.hpp as follows (in namespace boost::uuids):
std::size_t hash_value(uuid const& u)
{
size_t seed = 0;
for(uuid::const_iterator i=u.begin(); i != u.end(); ++u) {
seed ^= static_cast<size_t>(*i) + 0x9e3779b9 + (seed << 6) +
(seed >> 2);
}
return seed;
}
Thanks,
Andy Tompkins
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk