summaryrefslogtreecommitdiff
path: root/include/memory
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-12-02 23:38:31 +0000
committerEric Fiselier <eric@efcs.ca>2016-12-02 23:38:31 +0000
commit120401a4e033c11adf325dc786b7d5893a7c001d (patch)
tree1f27d20161e483c65a88f072e5934243f5b292a1 /include/memory
parent4975ccc637b9c2e4c47a3271650a30777685aebd (diff)
Make variant's index part of the hash value
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288554 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/memory')
-rw-r--r--include/memory11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/memory b/include/memory
index 24361cc8e..e4cb58b8d 100644
--- a/include/memory
+++ b/include/memory
@@ -3345,6 +3345,17 @@ struct __scalar_hash<_Tp, 4>
}
};
+_LIBCPP_INLINE_VISIBILITY
+inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
+ struct _PairT {
+ size_t first;
+ size_t second;
+ };
+ typedef __scalar_hash<_PairT> _HashT;
+ const _PairT __p{__lhs, __rhs};
+ return _HashT()(__p);
+}
+
template<class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY hash<_Tp*>
: public unary_function<_Tp*, size_t>