Re: about std.string.representation

2013-11-19 Thread bioinfornatics
works as expected import std.traits : isSomeChar; import std.range: ElementEncodingType; import std.stdio; @safe pure nothrow template CharEncodingType(Char) { alias ET = ElementEncodingType!Char; static if (is (ET == char)) { alias CharEncodingType = ubyte; } else st

Re: about std.string.representation

2013-11-19 Thread bioinfornatics
I try this import std.traits : isSomeChar; import std.typetuple: TypeTuple; import std.stdio; template CharEncodingType(Char) { // Get representation type alias TypeTuple!(ubyte, ushort, uint) U; // const and immutable storage classes static if (is(Char == immutabl

Re: about std.string.representation

2013-11-19 Thread bioinfornatics
On Tuesday, 19 November 2013 at 23:53:33 UTC, bioinfornatics wrote: On Tuesday, 19 November 2013 at 06:11:26 UTC, Ali Çehreli wrote: On 11/18/2013 07:48 PM, bioinfornatics wrote: On Thursday, 14 November 2013 at 12:01:04 UTC, Ali Çehreli wrote: On 11/13/2013 04:32 PM, bioinfornatics wrote: Hi

Re: about std.string.representation

2013-11-19 Thread bioinfornatics
On Tuesday, 19 November 2013 at 06:11:26 UTC, Ali Çehreli wrote: On 11/18/2013 07:48 PM, bioinfornatics wrote: On Thursday, 14 November 2013 at 12:01:04 UTC, Ali Çehreli wrote: On 11/13/2013 04:32 PM, bioinfornatics wrote: Hi, I try to understand which type char, dchar, wchar will give ubyte,u

Re: about std.string.representation

2013-11-18 Thread Ali Çehreli
On 11/18/2013 07:48 PM, bioinfornatics wrote: On Thursday, 14 November 2013 at 12:01:04 UTC, Ali Çehreli wrote: On 11/13/2013 04:32 PM, bioinfornatics wrote: Hi, I try to understand which type char, dchar, wchar will give ubyte,ushort,uint… And for templates, there is std.range.ElementEncodin

Re: about std.string.representation

2013-11-18 Thread bioinfornatics
On Thursday, 14 November 2013 at 12:01:04 UTC, Ali Çehreli wrote: On 11/13/2013 04:32 PM, bioinfornatics wrote: Hi, I try to understand which type char, dchar, wchar will give ubyte,ushort,uint… And for templates, there is std.range.ElementEncodingType: import std.stdio; import std.range; vo

Re: about std.string.representation

2013-11-14 Thread Ali Çehreli
On 11/13/2013 04:32 PM, bioinfornatics wrote: Hi, I try to understand which type char, dchar, wchar will give ubyte,ushort,uint… And for templates, there is std.range.ElementEncodingType: import std.stdio; import std.range; void foo(R)(R range) { // In contrast, ElementType!R for strings

Re: about std.string.representation

2013-11-13 Thread Jared Miller
To expand on bearophile's answer, a dynamic array is basically a package of two things: a length and a pointer to the contents. Each of these is 8 bytes on a 64-bit system, thus the sizeof a dynamic array is 16 bytes. You are asking how char, wchar, and dchar correspond to integer types. That

Re: about std.string.representation

2013-11-13 Thread bearophile
bioinfornatics: each time it seem ushort is used someone coul explaen please? sizeof of a dynamic array always gives 2 * size_t.sizeof = 8 or 16 bytes. Bye, bearophile