Fixed a bug where the last column of data in a file wasn't loaded on

some OS X machines when load_libsvm_formatted_data() was called.
This commit is contained in:
Davis King 2015-05-25 16:39:53 -07:00
parent 03cfc68af8
commit c2ee7bbfd5
1 changed files with 3 additions and 1 deletions

View File

@ -85,12 +85,14 @@ namespace dlib
if (sin.get() != ':')
throw sample_data_io_error("On line: " + cast_to_string(line_num) + ", error while reading file " + file_name);
sin >> value >> ws;
sin >> value;
if (sin && value != 0)
{
sample.insert(sample.end(), make_pair(key, value));
}
sin >> ws;
}
samples.push_back(sample);