summaryrefslogtreecommitdiffstats
path: root/src/util/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/hash.h')
-rw-r--r--src/util/hash.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/util/hash.h b/src/util/hash.h
new file mode 100644
index 000000000..d5abeff5a
--- /dev/null
+++ b/src/util/hash.h
@@ -0,0 +1,41 @@
+/** @file
+ * Hash function for various things
+ */
+/* Authors:
+ * Krzysztof KosiƄski <tweenk.pl@gmail.com>
+ *
+ * Copyright (C) 2009 Authors
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifndef SEEN_UTIL_HASH_H
+#define SEEN_UTIL_HASH_H
+
+#include <boost/shared_ptr.hpp>
+
+namespace std {
+namespace tr1 {
+
+/** Hash function for Boost shared pointers */
+template <typename T>
+struct hash< boost::shared_ptr<T> > : public std::unary_function<boost::shared_ptr<T>, size_t> {
+ size_t operator()(boost::shared_ptr<T> p) const {
+ return reinterpret_cast<size_t>(p.get());
+ }
+};
+
+} // namespace tr1
+} // namespace std
+
+#endif
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :