Merge lp:~paul-lucas/zorba/feature-unordered_map into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Matthias Brantner
Approved revision: 10899
Merged at revision: 10902
Proposed branch: lp:~paul-lucas/zorba/feature-unordered_map
Merge into: lp:zorba
Diff against target: 36 lines (+15/-0)
1 file modified
src/util/hash/hash.h (+15/-0)
To merge this branch: bzr merge lp:~paul-lucas/zorba/feature-unordered_map
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+112679@code.launchpad.net

Commit message

Added the missing specialization for hash<unique_ptr<T,D>>.

Description of the change

Added the missing specialization for hash<unique_ptr<T,D>>.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job feature-unordered_map-2012-06-29T02-17-56.706Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve, 1 Pending.

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job feature-unordered_map-2012-06-29T03-29-54.186Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/util/hash/hash.h'
2--- src/util/hash/hash.h 2012-06-07 02:45:07 +0000
3+++ src/util/hash/hash.h 2012-06-29 01:45:24 +0000
4@@ -19,10 +19,15 @@
5
6 // zorba
7 #include <zorba/config.h>
8+#ifndef ZORBA_HAVE_UNORDERED_MAP
9+#include <zorba/internal/unique_ptr.h>
10+#endif /* ZORBA_HAVE_UNORDERED_MAP */
11
12 // standard
13 #include <functional>
14+#ifndef ZORBA_HAVE_UNORDERED_MAP
15 #include <string>
16+#endif /* ZORBA_HAVE_UNORDERED_MAP */
17 #include <sys/types.h>
18
19 // Exactly ONE of these should be defined.
20@@ -145,6 +150,16 @@
21 }
22 };
23
24+/** Specialization for \c unique_ptr. */
25+template<typename T,class D>
26+struct hash< unique_ptr<T,D> > :
27+ unary_function<unique_ptr<T,D> const&,size_t>
28+{
29+ size_t operator()( unique_ptr<T,D> const &p ) const {
30+ return reinterpret_cast<size_t>( p.get() );
31+ }
32+};
33+
34 #endif /* ZORBA_HAVE_UNORDERED_MAP */
35
36 /** Specialization for \c rstring. */

Subscribers

People subscribed via source and target branches