In my c++ template struct I want to use different container types which use different allocators, e.g. std::vector and thrust::device_vector.
I need to specify the allocator explicitely, otherwise I get "wrong number of template arguments (1, should be 2)":
template<typename T, template <typename, typename> class Container, typename Alloc>
struct wrap_into_container
{
typedef Container<T, Alloc> type;
};
Since the different container classes use different allocators, I have to specify the corresponding allocator everytime I want to use this template.
How can I get the allocator depending on the Container type without having to specify it?
I thought of using a traits struct which I then specialize for each Container type, but I don't know how to implement it or if it is even useful / possible / ...
UPDATE: I cannot use C++11 unfortunately due to restrictions of the NVIDIA compiler ...