12template<
class T,
class TNull>
15 static_assert(std::is_base_of<T, TNull>::value,
"TNull has to be a subtype of T");
33 if (service ==
nullptr)
36 service_ = &nullService_;
45 static TNull nullService_;
48template<
class T,
class TNull> TNull Locator<T, TNull>::nullService_;
49template<
class T,
class TNull> T* Locator<T, TNull>::service_ = &Locator<T, TNull>::nullService_;
Locator is an utility class based on the Locator design-patter.
Definition: service_locator.h:14
static T & get()
get is a method that gets you the reference to the T class. If a pointer was not provided,...
Definition: service_locator.h:22
static void provide(T *service)
provide is a method that allows to provide a pointer to a class T object.
Definition: service_locator.h:31