if(transition == *(vec.end()-1)) { //vec contains the ASCI code
vec.pop_back();
--vec_index;
result.append(vec[vec_index]);
} else if(colors.find(modified.substr(1)) == colors.end()) {
cout << result << endl;
cout << "\033[0;37m";
cerr << "**ERROR: INVALID CLOSING COLOR TAG ON LINE: "
//cerr << "**ERROR: OVERLAPPING CLOSING COLOR TAG ON LINE: "
<< nlines << endl;
exit(0);
} else {
cout << result << endl;
cout << "\033[0;37m";
cerr << "**ERROR: INVALID CLOSING COLOR TAG ON LINE: "
//cerr << "**ERROR: OVERLAPPING CLOSING COLOR TAG ON LINE: "
<< nlines << endl;
exit(0);
}
我有麻煩的部分在上面的代碼,我的其他-if語句似乎並沒有在所有執行。我試圖做的是當在地圖中未找到modified.substr(1)時,會先打印第一個錯誤(顏色字符串在地圖中,但與矢量中的最後一個不同)打印「其他」錯誤。但是,我的其他情況始終是打印。之所以修改.substr(1)是因爲修改(在這種情況下)以/開頭。
給我們更多的代碼 - 「vec」,「modified」(可能還有一些)是空的。 –