I want to create an open hash table.
And i want to use an array of lists, where the size of the array is a template parameter, but the problem is i don't know how to pass an allocator to all of the list instances, and i cannot use vector, because i will need another allocator for list allocation (alloception), is there a way to initialize a whole array of lists with the same value?
I know i can initialize like this list<int> mylist[] = {{allocator}, {allocator}, {allocator}}
But the idea is to have size as a template variable. Example:
template<typename KEY, typename VAL, typename ALLOC=std::allocator<struct _internal>, size_t TBL_SIZE=100>
class open_hash_table{
private:
std::list<struct _internal, ALLOC=ALLOC> _table[TBL_SIZE];
public:
open_hash_table(ALLOC allocator=ALLOC())
:_table({allocator, allocator ... allocator}){}
};
P.s. my compiler supports upto c++11