#include #include #include #include #include #include namespace mbgl { namespace util { template class ThreadLocal::Impl { public: QThreadStorage> local; }; template ThreadLocal::ThreadLocal() : impl(std::make_unique()) { set(nullptr); } template ThreadLocal::~ThreadLocal() { // ThreadLocal will not take ownership // of the pointer it is managing. The pointer // needs to be explicitly cleared before we // destroy this object. assert(!get()); } template T* ThreadLocal::get() { return impl->local.localData()[0]; } template void ThreadLocal::set(T* ptr) { impl->local.localData()[0] = ptr; } template class ThreadLocal; template class ThreadLocal; template class ThreadLocal; // For unit tests } // namespace util } // namespace mbgl