lundi 25 janvier 2016

Working with a vector of pair vectors?

I've been search around Google but I didn't find what I need. I'm trying to create a vector that allows me to add 3 (and after I'll need to store 4) variables, access and sort them.

I'm implementing the vector as follows for 3 variables:

std::vector<std::pair<std::string, std::pair<int, double> > > chromosomes;

To add information (variables), I'm doing:

chromosomes.emplace_back(dirp->d_name, std::make_pair(WSA, fault_percent));

How can I access each parameter and sort them based on the WSA and fault coverage? As in a vector of pair that I can do that using members first and second.

And for 4 variables, it would be as follows?

std::vector<std::pair<std::string, std::string>, std::pair<int, double> > > chromosomes;

chromosomes.emplace_back( std::make_pair(dirp->d_name, x), std::make_pair(WSA, fault_percent));`

Aucun commentaire:

Enregistrer un commentaire