I have a multimap defined by
typedef std::pair<int, int> au_pair; //vertices
typedef std::pair<int, int> acq_pair; //ch qlty specified by C
typedef std::multimap<int, acq_pair> au_map;
typedef au_map::iterator It_au;
The no. of simulations depend on the size of the au_map
. For eg: if the au_map.size() = 5
I will have C1, C2, C3, C4, C5. and therefore 2^5 = 32 cases.
For example: If the au_map.size()=4
, I need to simulate my algorithm for 16 cases.
for(size_t i = 0; i != 16; ++i)
{
for(It_au it = a_map.begin(); it != a_map.end();)
{
acq_pair it1 = it->second;
//case 0:
//C1 = 0, C2 = 0, C3 = 0, C4 = 0
//@Matthieu M 's suggestion http://stackoverflow.com/questions/3110975/c-case-declaration-closed
//bool const c1 = i & 1;
//bool const c2 = i & 2;
//bool const c3 = i & 4;
//bool const c4 = i & 8;
//Update it1.second with corresponding C values
it->second.second = C1;
it++;
it->second.second = C2;
it++;
it->second.second = C3;
it++;
it->second.second = C4;
it++;
}
//simulate algorithm
}
How can I automate this process, where the size of C changes according to the au_map.size()
? Thus, I will have C1, C2, C3, C4 when au_map.size() = 4
and C1, C2, C3, C4, C5 when au_map.size() = 5
.
Also, what's preferred a vector with these values or add this to a pair inside multimap? Vector lookup time is lesser than multimap.
Also, if I keep inserting values to a multimap, will the new/updated values be passed to the algorithm?