Closed GoogleCodeExporter closed 8 years ago
The parameter to the single_line_comment template is the character with which
the comment line should start. Your lines are empty and thus do not start with
'\r' nor with '\n'. Because internal C-strings are used, the first char in the
line is a '\0' and thus
io::CSVReader<NCOL,io::trim_chars<'
'>,io::no_quote_escape<','>,io::throw_on_overflow,io::single_line_comment<'\0'>
>in(filename);
does the trick if your lines are perfectly empty. If you also want to ignore
lines that contain only spaces then you have to write your own policy:
struct empty_line_comment{
static bool is_comment(const char*line){
while(*line == ' ' || *line == '\t'){
++line;
if(*line == 0)
return true;
}
return false;
}
};
and use it as following:
io::CSVReader<NCOL,io::trim_chars<'
'>,io::no_quote_escape<','>,io::throw_on_overflow,empty_line_comment>in(filename
);
Original comment by strasser...@gmail.com
on 8 Apr 2014 at 1:45
Typo:
struct empty_line_comment{
static bool is_comment(const char*line){
if(*line == '\0')
return true;
while(*line == ' ' || *line == '\t'){
++line;
if(*line == 0)
return true;
}
return false;
}
};
Original comment by strasser...@gmail.com
on 8 Apr 2014 at 1:48
Original issue reported on code.google.com by
pier.mo...@gmail.com
on 17 Dec 2013 at 9:39