[RESOLVED] Identifying container type in template
Can anyone think of a way of identifying the container type used, so that a template class can be specialised according to whether the type is vector, list etc.
This won't compile as the vector requires template arguments.
Code:
template <typename T>
struct Test
{
void Function(); // Standard function
};
template<>
struct Test<std::vector>
{
void Function(); // Optimised function for all vector specialisations
};
I'm trying to specialise an STL allocator. If I include the template parameters in the specialisation I end up with a recursive definition.
i.e. The allocator template requires a container parameter that requires an allocator parameter that requires....
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman