0
클래스를 사용하지 않고 연도에 따라 게시 목록을 정렬하는 cpp 프로그램을 구현하려고합니다.C++ 클래스 또는 구조체없이 데이터 형식 정렬
각각 tabspace로 구분,의이 정보를 텍스트 파일로했다 가정 해 봅시다 :
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.
}
(바람직 벡터 포함) 목록에서이 데이터를 저장해야
제 질문은이 데이터를 벡터에 저장하는 방법입니다. 나중에 함수에서 연도별로 전체 벡터를 정렬 할 수 있습니까? 또한, 단지 한 줄 이상의 정보가 있는지 알아보기 위해 반복해야합니다.
람다를 사용하는 [C++ 11 정렬 목록] (https://stackoverflow.com/questions/22281962/c11-sorting-list-using-lambda)의 가능한 복제본 –
'vector>'는 int 구성 요소에 따라 정렬 될 수 있습니다. ** 구조체를 사용하지 않는 이유는 무엇입니까? –