Opened 7 years ago
Last modified 7 years ago
#11843 new Bugs
shared_ptr hash support doesn't work for shared_ptr<T[]> or shared_ptr<T[N]>
| Reported by: | 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.
Note:
See TracTickets
for help on using tickets.

Should be fixed in https://github.com/boostorg/smart_ptr/commit/4473bf8ec2a1a124713dcc4183d6c120f5191305