I am trying to allocate a vector during the default constructor of an object I have.
What I am trying to allocate is this:
What I want is a vector of size 4 to be allocated with each slot containing an empty 'bin_index' object.Code:vector<bin_index> m_table;
I have a default constructor for bin_index to set values to 0 but it is still not working. This is what I have tried so far:
I know you can allocate a vector initially just like an array but I am having some trouble with the syntax when it includes objects. I am allocating it initially because I am implementing a hash table so I need a vector instead of an array.Code://try number 1 bin_index bi; m_table(4,bi); //try number 2 m_table(4,bin_index()); //try number 3 m_table(4);
Here is the basic error message I keep getting:
Code:error: no match for call to ‘(std::vector<bin_index, std::allocator<bin_index> >) (int, bin_index&)’



LinkBack URL
About LinkBacks



