, .
, , , , ... , .
, Loki::Singleton, .
template
<
typename T,
template <class> class CreationPolicy = CreateUsingNew,
template <class> class LifetimePolicy = DefaultLifetime,
template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL,
class MutexPolicy = LOKI_DEFAULT_MUTEX
>
class SingletonHolder;
, ?
- , , .
Well, now I have to admit that I'm not quite sure that I need a class with a given number of template parameters, personally, I would prefer something:
template
<
class T,
class CreationPolicy = CreateUsingNew<T>,
class LifetimePolicy = DefaultLifeTime<T>,
class MutexPolicy = LOKI_DEFAULT_MUTEX,
template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL
>
class SingletonHolder;
The latter cannot help; you must pass it to the class itself SingletonHolder.
However, it’s easier for me to exchange policies here, this allows me to define policies such as:
template <class T, size_t Param> MyCreationPolicy;
And use directly, without wrapping it for the given parameter value, so that it matches the signature.
source
share