I want to insert values into a vector
of set<int>
, which is defined using typedef
as given below:
typedef std::set<int> blockSet_t;
std::vector<blockSet_t>* myvector
I want to have values such that myvector[0]
has a set
of int
s, myvector[1]
has a different set
of int
s and so on.
Currently, I am passing this vector
to a function which is parsing a file that has the set
of integers.
Like:
main()
{
std::vector<blockSet_t> myvector;
filereader(myvector);
}
I read the set
from the file and store it in a different blockSet_t myset;
I am using the following loop to store this set
to a specific location in the vector
:
filereader(&myvector)
{
for(int i=0;i<size;i++)
{
myvector.push_back(myset); // It does not give error but I don't know myset is stored in which location
//what I want is to have someting like this
myvector[i].push_back(myset); //so I can store different sets at different locations
}
}
I also could not figure out, how to display the values from within thevector
.
Since it is a vector of set
s, I want to display each set
(on a different vector
index).
Any help in this regard is much appreciated.
Thanks.