On 11/02/2014 04:58 PM, bioinfornatics wrote:
> Dear,
> Some problem to build this code: http://fpaste.org/147327/75948141/
>
>
> $ ldc2 fasta_test.d
> /usr/include/d/std/range.d(3605): Error: template std.array.save
> cannot deduce function from argument types !()(ByChunk),
> candidates are:
I think that is due to the too permissive template constraint of takeOne
in phobos/std/range.d. Even though it say "isInputRange!R", it clearly
needs "isForwardRange!R" because it calls .save() on that range:
@property auto save() { return Result(_source.save, empty); }
So, the following is wrong:
auto takeOne(R)(R source) if (isInputRange!R)
It should be:
auto takeOne(R)(R source) if (isForwardRange!R)
If you modify range.d locally to require ForwardRange, you will see that
your following call will get an error message because byChunk is not a
ForwardRange:
// Take a piece of byte from current file
ubyte[] buffer = takeOne(inputRange);
I think this issue is already reported as a part of the following bug:
https://issues.dlang.org/show_bug.cgi?id=9724
Ali