Opened 3 years ago

Last modified 3 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.

Change History (1)

Note: See TracTickets for help on using tickets.