// Copyright (c) 2015, Cloudera, inc.
// Confidential Cloudera Information: Covered by NDA.

#ifndef KUDU_UTIL_SHARED_PTR_UTIL_H_
#define KUDU_UTIL_SHARED_PTR_UTIL_H_

#include <cstddef>
#include <tr1/memory>

namespace kudu {

// This is needed on TR1. With C++11, std::hash<std::shared_ptr<>> is provided.
template <class T>
struct SharedPtrHashFunctor {
  std::size_t operator()(const std::tr1::shared_ptr<T>& key) const {
    return reinterpret_cast<std::size_t>(key.get());
  }
};

} // namespace kudu

#endif // KUDU_UTIL_SHARED_PTR_UTIL_H_

Add hash function for std::tr1::shared_ptr<>
Add hash function for std::tr1::shared_ptr<>

This exists as a std::hash<> specialization for std::shared_ptr in C++11
but it does not ship with TR1.

Change-Id: Id342f8e9c45f93a2b22e530a689ca18ebf8534b1
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/5998
Tested-by: Michael Percy <e07a1fd797b473a9c849e618aa2ce06d8055760b@cloudera.com>
Reviewed-by: Todd Lipcon <2c763d726a8c2f6afda9be7e0e56a2caa6bb5e6b@cloudera.com>
