This repository has been archived on 2026-04-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Tortuga/common/service_locator.hpp
T
2013-06-09 17:06:32 +10:00

22 lines
318 B
C++

#ifndef SERVICELOCATOR_HPP_
#define SERVICELOCATOR_HPP_
template<typename T>
class ServiceLocator {
public:
static T* Set(T* t) {
delete service;
return service = t;
}
static T* Get() {
return service;
}
private:
static T* service;
};
template<typename T>
T* ServiceLocator<T>::service = nullptr;
#endif