std.csv.csvReader operating on File.byLine()

Rene Zwanenburg renezwanenburg at gmail.com
Sun Oct 7 11:21:28 PDT 2012


Hi,

To my understanding, The csv reader in std.csv is able to operate 
on any kind of input range. However I can only get it to work on 
strings. Please take a look at the following line of code. Did I 
make some mistake?

auto reader = csvReader!(Tuple!(int, int, 
float))(someFile.byLine());

When I try to compile that, the compiler output is:

main.d(24): Error: template std.csv.csvReader does not match any 
function template declaration
C:\D\dmd2\windows\bin\..\..\src\phobos\std\csv.d(283): Error: 
template std.csv.csvReader cannot deduce template function from 
argument types !(Tuple!(int,int,float))(ByLine!(char,char))
main.d(24): Error: template instance 
csvReader!(Tuple!(int,int,float)) errors instantiating template

As a workaround I could use readText, but that's dirty and won't 
work for large csv files.


More information about the Digitalmars-d-learn mailing list