Delete copy/move constructors on these RAII guards. (#32727)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32727

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Differential Revision: D19621858

Pulled By: ezyang

fbshipit-source-id: 5112c849252478d8249de4f8c8c5a2d6caf60672
This commit is contained in:
Edward Yang 2020-01-29 13:16:37 -08:00 committed by Facebook Github Bot
parent 5ffa1efa52
commit c7df28a2a3

View file

@ -61,6 +61,10 @@ C10_API LocalDispatchKeySet tls_local_dispatch_key_set();
class C10_API IncludeDispatchKeyGuard {
public:
IncludeDispatchKeyGuard(DispatchKey);
IncludeDispatchKeyGuard(const IncludeDispatchKeyGuard&) = delete;
IncludeDispatchKeyGuard operator=(const IncludeDispatchKeyGuard&) = delete;
IncludeDispatchKeyGuard(IncludeDispatchKeyGuard&&) = delete;
IncludeDispatchKeyGuard operator=(IncludeDispatchKeyGuard&&) = delete;
~IncludeDispatchKeyGuard();
private:
// A little micro-optimization to save us from tls_get_addr call
@ -73,6 +77,10 @@ private:
class C10_API ExcludeDispatchKeyGuard {
public:
ExcludeDispatchKeyGuard(DispatchKey);
ExcludeDispatchKeyGuard(const ExcludeDispatchKeyGuard&) = delete;
ExcludeDispatchKeyGuard operator=(const ExcludeDispatchKeyGuard&) = delete;
ExcludeDispatchKeyGuard(ExcludeDispatchKeyGuard&&) = delete;
ExcludeDispatchKeyGuard operator=(ExcludeDispatchKeyGuard&&) = delete;
~ExcludeDispatchKeyGuard();
private:
// A little micro-optimization to save us from tls_get_addr call