I have an array which is to be filled using an object like this -
const std::map<Id, std::vector<Data>> *const DataSets[]=
{
&object.data1,
&object.data2,
&object.data3,
&object.data4
};
Condition here is, If object.data1.size() == 0 I dont want to push it into array. in that case I want to fill my array like this -
const std::map<Id, std::vector<Data>> *const DataSets[]=
{
&object.data2,
&object.data3,
&object.data4
};
UPDATE I am using std::vector instead of array now and trying to initialize vector in same as array -
const std::vector<std::map<Id, std::vector<Data>>> *const DataSets
{
&object.data1,
&object.data2,
&object.data3,
&object.data4
};
I am getting error: E0146 too many initializer values. Can't I initialize my vector in this way? If not can anyone please suggest how to do that?
Thanks in advance!
std::vectorinstead, and push the items as needed?