In general, how would you request vector<T>
as a type in a template?
template<?vector<T>?>
void allocate() {
vector<T> vector;
}
To be more specific (the example above is a bit dumb), I'm using a service_locator<T>
from this library and all of its members are static. The constructor and the destructor of that struct are deleted, therefore there is no such thing as an instance of a service_locator<T>
. I'd like to write a function that does something, given some service_locator<T>
. Something like the following.
template<?service_locator<T>?> // What do I write here?
T& assertedRef() {
assert(!service_locator<T>::empty(), "Value not initialized for that type!");
return service_locator<T>::ref();
}
My current workaround is to ask for T
instead of service_locator<T>
. This is a hassle for the callers because it's on them to figure out the underlying type the service_locator
is operating on (most of them are aliased to something more readable).