Prevent VS from emitting errors when using swap in Optional.h (#22182)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/21706
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22182
Differential Revision: D15981740
Pulled By: ezyang
fbshipit-source-id: d58b3ca3aea8d3d383150208b87fa4bbd4f6fe33
diff --git a/c10/util/Optional.h b/c10/util/Optional.h
index adde895..5a90096 100644
--- a/c10/util/Optional.h
+++ b/c10/util/Optional.h
@@ -516,7 +516,7 @@
// 20.5.4.4, Swap
void swap(optional<T>& rhs) noexcept(
std::is_nothrow_move_constructible<T>::value&& noexcept(
- swap(std::declval<T&>(), std::declval<T&>()))) {
+ std::swap(std::declval<T&>(), std::declval<T&>()))) {
if (initialized() == true && rhs.initialized() == false) {
rhs.initialize(std::move(**this));
clear();