From: Christopher Dykes Date: Sun, 21 Aug 2016 17:02:55 +0000 (-0700) Subject: Get ObserverManager compiling under MSVC X-Git-Tag: v2016.08.22.00~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7ae5a5e444b0589dfaa7b5dee9689e25c6185bfe;p=folly.git Get ObserverManager compiling under MSVC Summary: It only needed a minor tweak, but the change still had to be made :( Reviewed By: andriigrynenko Differential Revision: D3745021 fbshipit-source-id: 286c6db706c3571842006537c6b17f506609e51d --- diff --git a/folly/experimental/observer/detail/ObserverManager.cpp b/folly/experimental/observer/detail/ObserverManager.cpp index 24acabad..e29522ab 100644 --- a/folly/experimental/observer/detail/ObserverManager.cpp +++ b/folly/experimental/observer/detail/ObserverManager.cpp @@ -161,11 +161,16 @@ void ObserverManager::scheduleNext(Core::Ptr core) { struct ObserverManager::Singleton { static folly::Singleton instance; + // MSVC 2015 doesn't let us access ObserverManager's constructor if we + // try to use a lambda to initialize instance, so we have to create + // an actual function instead. + static ObserverManager* createManager() { + return new ObserverManager(); + } }; -folly::Singleton ObserverManager::Singleton::instance([] { - return new ObserverManager(); -}); +folly::Singleton ObserverManager::Singleton::instance( + createManager); std::shared_ptr ObserverManager::getInstance() { return Singleton::instance.try_get();