没有 类 或结构的 C++ 排序数据类型

C++ Sorting Data Type without classes or structs

尝试实现一个 cpp 程序,在不使用 class 的情况下根据年份对出版物列表进行排序。

假设此信息在一个文本文件中,每个文件由制表符分隔:

save_app    "authors_list3"  "title3"   "conference2"   2010    "oral"

并且在这个函数中,我必须将这些数据存储在一个列表中(最好使用向量)

#include <tuple>
...
void SaveApp(const vector<string>& tokens){

  string authors = tokens[1];
  string title = tokens[2];
  string venue = tokens[3];
  int year = atoi(tokens[4].c_str());
  string presentation = tokens[5];

  vector<tuple<string, string, string, int, string>> line; //I used this because there's no boost function.

}

我的问题是如何将这些数据存储到一个向量中,以便在以后的函数中,我可以只根据年份对整个向量进行排序?此外,我需要迭代以查看是否不止 1 行信息。

当在 vector< pair< int,tuple< string,string,string,string> > > v 上调用 sort(v.begin(),v.end()) 时,它按整数排序。