Boost logo

Boost Users :

From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2007-03-15 10:20:09


> Looks like an overzealous or simply misguided warning. Can you please
> try the following?
>
> #include <boost/functional/hash/hash.hpp>
> #include <cstddef>
>
> int main()
> {
> std::size_t x=0;
> boost::hash<std::size_t>()(x);
> }
>
> Same warning? If so, you might ask for inclusion of a suitable
> #pragma warning(disable...) to the Boost.Hash author.
>
Yes...in fact,

    boost::hash<unsigned int>()(x);

works fine, since the function being called (via boost::hash and
boost::call_hash) is defined as

    inline std::size_t hash_value(unsigned int v)
    {
        return static_cast<std::size_t>(v);
    }

There are other variants of this function, taking bool, int, etc. as the
argument, but no size_t.
 I'm not sure what is the official interface of boost::hash, so I don't
know whether it's being used correctly in multi_index or not.

Cheers,
Filip


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net