Synchronized: disable operator= when the type isn't copy assignable
authorMaxime Boucher <maxime@instagram.com>
Sat, 19 Nov 2016 00:53:50 +0000 (16:53 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Sat, 19 Nov 2016 01:08:53 +0000 (17:08 -0800)
commit4a3cdfdcd873008434204074aee5b0713511a740
tree0d61c9fd060d9aec42780f24e4e2c2b412aedafc
parentadbc74b77ca2134afb7205df718884477e30e7ce
Synchronized: disable operator= when the type isn't copy assignable

Summary: The value of std::is_copy_assignable<folly::Synchronized<T>>::value is incorrect when T isn't copy assignable. As a result, it isn't possible to use SFINAE to properly select a function when the base type is a folly::Synchronized. This diff selectively deletes the copy constructor and copy assignment operator when the underlying type T isn't copyable. This is most useful in the case of folly::Synchronized<std::unique_ptr<...>>

Reviewed By: yfeldblum

Differential Revision: D4203081

fbshipit-source-id: 1e811f9e52db26c23b1c6f1907bac9e2854ddb9d
folly/Synchronized.h
folly/test/SynchronizedTest.cpp