mercredi 19 octobre 2016

Split an std::set into vectors of equal size

I have an std::set of integers of say 550 elements. I want to split this into vectors of size 100 or less. So, lets say, in this case we will get 6 vectors in all. First 5 vectors will be of sizes 100 and the sixth vector will be of size 50.

So, effectively I need to break std::setmasterSet into std::vector>final. Is there a good and crisp way to do it using some standard std algorithms. I dont need a class to have this logic, infact I can write a function to do this.

Aucun commentaire:

Enregistrer un commentaire