Modify

Opened 2 years ago

Last modified 2 years ago

#11843 new Bugs

shared_ptr hash support doesn't work for shared_ptr<T[]> or shared_ptr<T[N]>

Reported by: rs2740@… Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

Repro:

#include <boost/functional/hash.hpp>
#include <boost/shared_ptr.hpp>

int main(){
    boost::shared_ptr<int[2]> a;
    boost::shared_ptr<int[]> b;
    boost::hash_value(a);
    boost::hash_value(b);
}

The hash_value overload for shared_ptr<T> returns boost::hash< T* >()( p.get() ). It should presumably return boost::hash<typename shared_ptr<T>::element_type*>()(p.get()) instead.

Attachments (0)

Change History (1)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Peter Dimov.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.