Commit e9715ac6 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Avoid errnoeous deprecation warning in F14BasicSet

Summary:
[Folly] Avoid errnoeous deprecation warning in `F14BasicSet`.

The deprecation warning is emitted for instantiations like `F14FastSet<std::string>`.

The warning is triggered by looking for move-constructibility of the mapped type for maps or `void` for sets, but `void` is not move-constructible. There are a variety of techniques to solve this, and the smallest change is to use `lift_unit_t` in the right place. `Unit` is move-constructible where `void` is not.

Reviewed By: nbronson

Differential Revision: D8178045

fbshipit-source-id: 1ca06e84b4ed7acd415901afcbe80663513063ea
parent 6e612d3d
......@@ -21,6 +21,7 @@
#include <type_traits>
#include <utility>
#include <folly/Unit.h>
#include <folly/container/detail/F14Table.h>
#include <folly/hash/Hash.h>
#include <folly/lang/SafeAssert.h>
......@@ -498,7 +499,7 @@ class ValueContainerPolicy : public BasePolicy<
void moveItemDuringRehash(Item* itemAddr, Item& src) {
complainUnlessNothrowMove<Key>();
complainUnlessNothrowMove<MappedTypeOrVoid>();
complainUnlessNothrowMove<lift_unit_t<MappedTypeOrVoid>>();
constructValueAtItem(0, itemAddr, Super::moveValue(src));
if (destroyItemOnClear()) {
......@@ -1055,7 +1056,7 @@ class VectorContainerPolicy : public BasePolicy<
void transfer(Alloc& a, Value* src, Value* dst, std::size_t n) {
complainUnlessNothrowMove<Key>();
complainUnlessNothrowMove<MappedTypeOrVoid>();
complainUnlessNothrowMove<lift_unit_t<MappedTypeOrVoid>>();
if (std::is_same<Alloc, std::allocator<Value>>::value &&
FOLLY_IS_TRIVIALLY_COPYABLE(Value)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment