I am having trouble to figure out, how to sort a vector of vector of strings, here is the testing code.
#include <iostream>
#include <vector>
#include <boost/algorithm/string.hpp>
int main(int argc, char** argv) {
std::vector <std::vector <std::string> > data_var;
std::vector <std::string> temp;
std::string str1 = "1,hello3,temp2";
std::string str2 = "2,hello2,temp1";
std::string str3 = "3,hello1,temp3";
boost::split(temp, str1, boost::is_any_of(","));
data_var.push_back(temp);
boost::split(temp, str2, boost::is_any_of(","));
data_var.push_back(temp);
boost::split(temp, str3, boost::is_any_of(","));
data_var.push_back(temp);
// sorting code here...
}
Thanks in advance...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…