Commit 60c9115b authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Let SingletonHolder call createGlobal with no args

Summary: [Folly] Let `SingletonHolder` call createGlobal with no args. This was the only non-test call-site calling it with an argumnet.

Reviewed By: andriigrynenko

Differential Revision: D13114710

fbshipit-source-id: 55205a69d25966ee9fb09d5daefed1f9ecad80b9
parent 9aede428
......@@ -21,11 +21,14 @@ namespace detail {
template <typename T>
template <typename Tag, typename VaultTag>
SingletonHolder<T>& SingletonHolder<T>::singleton() {
struct SingletonHolderImpl : SingletonHolder<T> {
SingletonHolderImpl()
: SingletonHolder<T>(
{typeid(T), typeid(Tag)},
*SingletonVault::singleton<VaultTag>()) {}
};
/* library-local */ static auto entry =
createGlobal<SingletonHolder<T>, std::pair<Tag, VaultTag>>([]() {
return new SingletonHolder<T>(
{typeid(T), typeid(Tag)}, *SingletonVault::singleton<VaultTag>());
});
createGlobal<SingletonHolderImpl, void>();
return *entry;
}
......
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