由于std::sorta std::list,我收到以下错误:
line 44 : instantiated from here line 5258 : error: no match for 'operator-' in '_last -__first' line 179 : note: candidates are: ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const std::_Bit_iterator_base&)
从以下代码:
int main()
{
std::list<Student_info> students;
Student_info record;
string::size_type maxlen = 0; // the length of the longest name
// read and store all the students data.
while (read(cin, record))
{
// find length of longest name
maxlen = max(maxlen, record.name.size());
students.push_back(record);
}
// alphabetize the student …Run Code Online (Sandbox Code Playgroud) c++ ×1