Summary:
MSVC generates warnings if you define multiple assignment operators or multiple copy constructors on the same type. This is deliberate in `folly::Function`, so just disable the warnings for the struct instead.
Note that the warnings have to be disabled for the entire struct for them to actually be disabled. Disabling them just around the declarations of the constructors and operators in question does not actually disable the warnings.
Reviewed By: yfeldblum
Differential Revision:
D3347746
fbshipit-source-id:
abb53a1e62bcfb7ce02759a7ce8637d824a82081
#include <utility>
#include <folly/CppAttributes.h>
+#include <folly/Portability.h>
namespace folly {
} // namespace function
} // namespace detail
+FOLLY_PUSH_WARNING
+FOLLY_MSVC_DISABLE_WARNING(4521) // Multiple copy constructors
+FOLLY_MSVC_DISABLE_WARNING(4522) // Multiple assignment operators
template <typename FunctionType>
class Function final : private detail::function::FunctionTraits<FunctionType> {
// These utility types are defined outside of the template to reduce
return Impl{std::make_shared<Function>(std::move(*this))};
}
};
+FOLLY_POP_WARNING
template <typename FunctionType>
void swap(Function<FunctionType>& lhs, Function<FunctionType>& rhs) noexcept {