} // 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 std::move(*this).asSharedProxy();
}
};
-FOLLY_POP_WARNING
template <typename FunctionType>
void swap(Function<FunctionType>& lhs, Function<FunctionType>& rhs) noexcept {
/**
* Construct a FunctionRef from a reference to a callable object.
*/
- template <typename Fun>
+ template <
+ typename Fun,
+ typename std::enable_if<
+ !std::is_same<FunctionRef, typename std::decay<Fun>::type>::value,
+ int>::type = 0>
/* implicit */ FunctionRef(Fun&& fun) noexcept {
using ReferencedType = typename std::remove_reference<Fun>::type;