On Friday, 22 November 2013 at 10:07:12 UTC, Jonathan M Davis wrote:
On Friday, November 22, 2013 10:17:40 bioinfornatics wrote:
On Friday, 22 November 2013 at 07:54:45 UTC, Jonathan M Davis

wrote:
> On Friday, November 22, 2013 01:01:52 bioinfornatics wrote:
>> hi with this code: http://www.dpaste.dzfl.pl/2f830da1
>> I do not understand why alias Char is equal to >> immutable(char) >> >> How to fix these issues? > > I'm not quite sure which line you're refering to here, but
> ElementEncodingType
> is going to give the same constness as the elements - e.g.
> ElementEncodingType!string is going to be immutable(char), > not
> char.
> > Also, you're doing something with AAs, and all keys for AAs > are
> immutable,
> even if you don't explicitly mark them as immutable, so if if
> the type that
> you're using ElementEncodingType was a key in an AA, that > could
> be your
> problem.
> > However, the first error that's popping up seems to relate to
> the fact that
> ranges treat strings as ranges of dchar, not char, so > sequence
> gives you
> letters which are dchar, not char, and then you try and > assign
> it to an AA
> which holds immutable(char) rather than dchar (and the fact
> that the AA holds
> immutable(char) rather than char might cause further problems
> with being able
> to reassign anything in the AA - and if it doesn't it's
> probably due to the AA
> doing casting internally when it shouldn't).
> > - Jonathan M Davis

Thanks Jonathan

I try to have a dynamic type
If sequence is immutable(char)[] AA become char[ubyte]
If sequence is immutable(dchar)[] AA become dchar[ushort] …

Then you can't put sequence in a range and get its value out from there. immutable(char)[]will be treated as a range of dchar, so you'll get dchars, not chars. If you want to operate on a string as chars, then don't use it as a range. The closest that you could get to operating on it as a range of chars
would be to use std.string.representation and operate on it as
immutable(ubyte)[].

- Jonathan M Davis

std.string.representation is great but return a numeric array instead of numeric type. Ex ubyte[]
 For ascii but me i try to get ubyte.

Reply via email to