From 6c50fe1ec9eb35f69d3b4d38cc7475a83113932e Mon Sep 17 00:00:00 2001 From: sdong Date: Fri, 20 Mar 2020 14:42:47 -0700 Subject: [PATCH] Change HashMap::Insert()'s value to a const reference (#6567) Summary: When building RocksDB on VS2015, an error shows up with hash_map.h(39): error C2719: 'value': formal parameter with requested alignment of 8 won't be aligned Making the reference a reference can solve the problem, and there isn't a reason we can't do that, at least for the current use of the hash map. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6567 Test Plan: See CI tests pass. Reviewed By: pdillinger Differential Revision: D20548543 fbshipit-source-id: 255b55d74cf68a0b324e6f504c56608a97ea6276 --- util/hash_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/hash_map.h b/util/hash_map.h index 6eb42506b..e3ad2584f 100644 --- a/util/hash_map.h +++ b/util/hash_map.h @@ -36,7 +36,7 @@ class HashMap { return it != bucket.end(); } - void Insert(K key, V value) { + void Insert(K key, const V& value) { auto& bucket = table_[key % size]; bucket.push_back({key, value}); }