Skip to content

Commit 784d0f5

Browse files
committed
Use older vector constructor when allocating locks.
It seems like the vector(count, allocator) constructor is not available until C++14.
1 parent 2362469 commit 784d0f5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libcuckoo/cuckoohash_map.hh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public:
112112
minimum_load_factor_(DEFAULT_MINIMUM_LOAD_FACTOR),
113113
maximum_hashpower_(NO_MAXIMUM_HASHPOWER),
114114
max_num_worker_threads_(0) {
115-
all_locks_.emplace_back(std::min(bucket_count(), size_type(kMaxNumLocks)),
116-
get_allocator());
115+
all_locks_.emplace_back(get_allocator());
116+
all_locks_.back().resize(std::min(bucket_count(), size_type(kMaxNumLocks)));
117117
}
118118

119119
/**
@@ -695,7 +695,8 @@ private:
695695

696696
void add_locks_from_other(const cuckoohash_map &other) {
697697
locks_t &other_locks = other.get_current_locks();
698-
all_locks_.emplace_back(other_locks.size(), get_allocator());
698+
all_locks_.emplace_back(get_allocator());
699+
all_locks_.back().resize(other_locks.size());
699700
std::copy(other_locks.begin(), other_locks.end(),
700701
get_current_locks().begin());
701702
}
@@ -1822,8 +1823,8 @@ private:
18221823
return;
18231824
}
18241825

1825-
locks_t new_locks(std::min(size_type(kMaxNumLocks), new_bucket_count),
1826-
get_allocator());
1826+
locks_t new_locks(get_allocator());
1827+
new_locks.resize(std::min(size_type(kMaxNumLocks), new_bucket_count));
18271828
assert(new_locks.size() > current_locks.size());
18281829
std::copy(current_locks.begin(), current_locks.end(), new_locks.begin());
18291830
for (spinlock &lock : new_locks) {

0 commit comments

Comments
 (0)