Commit 68a47850 authored by Christopher Dykes's avatar Christopher Dykes Committed by facebook-github-bot-0

Use FOLLY_DEPRECATED rather than directly using GCC specific attributes.

Summary: Without this MSVC can't compile.

Reviewed By: lbrandy

Differential Revision: D2856598

fb-gh-sync-id: 0e146afe844b0ce5d3782528ed9c3de53f7c8b05
parent 25e4743f
......@@ -503,18 +503,15 @@ class Singleton {
// Generally your program life cycle should be fine with calling
// get() repeatedly rather than saving the reference, and then not
// call get() during process shutdown.
static T* get() __attribute__ ((__deprecated__("Replaced by try_get"))) {
return getEntry().get();
}
FOLLY_DEPRECATED("Replaced by try_get")
static T* get() { return getEntry().get(); }
// If, however, you do need to hold a reference to the specific
// singleton, you can try to do so with a weak_ptr. Avoid this when
// possible but the inability to lock the weak pointer can be a
// signal that the vault has been destroyed.
static std::weak_ptr<T>
get_weak() __attribute__ ((__deprecated__("Replaced by try_get"))) {
return getEntry().get_weak();
}
FOLLY_DEPRECATED("Replaced by try_get")
static std::weak_ptr<T> get_weak() { return getEntry().get_weak(); }
// Preferred alternative to get_weak, it returns shared_ptr that can be
// stored; a singleton won't be destroyed unless shared_ptr is destroyed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment