Re: [Boost-bugs] [Boost C++ Libraries] #5216: boost::hash<boost::shared_ptr<T>> Returns Only Two Values

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5216: boost::hash<boost::shared_ptr<T>> Returns Only Two Values
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-02-23 12:04:30


#5216: boost::hash<boost::shared_ptr<T>> Returns Only Two Values
---------------------------------------------------+------------------------
  Reporter: Rob Stewart <robert.stewart@…> | Owner: pdimov
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: smart_ptr
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords: shared_ptr hash
---------------------------------------------------+------------------------

Comment (by Rob Stewart <robert.stewart@…>):

 Defining BOOST_HASH_NO_IMPLICIT_CASTS produces a static assertion failure
 which is better than the silent misbehavior.

 The following makes things work, regardless of whether
 BOOST_HASH_NO_IMPLICIT_CASTS is defined:

 {{{
 namespace boost
 {
    template <class T>
    std::size_t
    hash_value(boost::shared_ptr<T> const & _ptr)
    {
       return boost::hash_value(_ptr.get());
    }
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5216#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC