Build error about LockingTextWriter

Ali Çehreli acehreli at yahoo.com
Sat Mar 3 07:38:48 PST 2012


On 03/03/2012 06:11 AM, bioinfornatics wrote:
 > Dear,
 > i do not understand what is wrong in my code and produce this:
 >
 > -------------------------
 > $ ldc2 ../../lib/libdscience-ldc.a -I=../.. fasta.d
 > /usr/include/d/std/range.d(295): Error: static assert  "Cannot put a
 > Sequence into a LockingTextWriter"
 >      instantiatied in /usr/include/d/std/format.d(1512):
 > put!(LockingTextWriter,Sequence)
 >      instantiatied in /usr/include/d/std/format.d(1869):
 > formatRange!(LockingTextWriter,Sequence,char)
 >      instantiatied in /usr/include/d/std/format.d(2232):
 > formatValue!(LockingTextWriter,Sequence,char)
 >      ... (1 instantiations, -v to show) ...
 >      instantiatied in /usr/include/d/std/stdio.d(684):
 > formattedWrite!(LockingTextWriter,char,Sequence)
 >      instantiatied in /usr/include/d/std/stdio.d(1563):
 > write!(Sequence,char)
 >      instantiatied in fasta.d(12): writeln!(Sequence)
 > -------------------------
 >
 >
 > sequence file can be show here:
 > 
https://gitorious.org/dscience/dscience/blobs/master/dscience/molecules/sequence.d
 >
 >
 > thanks
 >

Just by reading the code, LockingTextWriter can "put" only the dchar 
type. This is from std.stdio:

         /// Range primitive implementations.
         void put(A)(A writeme) if (is(ElementType!A : const(dchar)))
// ...
         void put(C)(C c) if (is(C : const(dchar)))

I haven't tried it myself, but changing the return type of 
Sequence.front() to dchar would work.

Ali



More information about the Digitalmars-d-learn mailing list