Re: The is expression

2011-04-02 Thread spir
On 04/02/2011 12:14 AM, enuhtac wrote: template isA( T ) { static if( is( T U == A!( U, s ), string s ) ) enum bool isA = true; else enum bool isA = false; }; What does , string s do here inside the is expression? Denis -- _ vita es estrany

Re: The is expression

2011-04-02 Thread enuhtac
Am 02.04.2011 11:24, schrieb spir: On 04/02/2011 12:14 AM, enuhtac wrote: template isA( T ) { static if( is( T U == A!( U, s ), string s ) ) enum bool isA = true; else enum bool isA = false; }; What does , string s do here inside the is expression? Denis A

Re: The is expression

2011-04-02 Thread enuhtac
Am 02.04.2011 04:00, schrieb Caligo: On Fri, Apr 1, 2011 at 5:14 PM, enuhtac enuhtac_li...@gmx.de wrote: Hello, the is expression is a great feature of D - but its use is not very intuitive, at least for me. I'm trying to write a template that figures out if the template parameter is of a

Static array size limit

2011-04-02 Thread simendsjo
http://digitalmars.com/d/2.0/arrays.html says static arrays are limited to 16mb, but I can only allocate 1mb. My fault, or bug? enum size = (16 * 1024 * 1024) / int.sizeof; //int[size] a; // Error: index 4194304 overflow for static array enum size2 = (16 * 1000 * 1000) /

Re: Static array size limit

2011-04-02 Thread simendsjo
This is using dmd 2.052 on windows by the way.

Re: Static array size limit

2011-04-02 Thread Jonathan M Davis
On 2011-04-02 06:21, simendsjo wrote: http://digitalmars.com/d/2.0/arrays.html says static arrays are limited to 16mb, but I can only allocate 1mb. My fault, or bug? enum size = (16 * 1024 * 1024) / int.sizeof; //int[size] a; // Error: index 4194304 overflow for static array

Re: Static array size limit

2011-04-02 Thread simendsjo
I think you missed my /int.sizeof at the end. enum size = (16*1024*1024)/int.sizeof; int[size] a; // Error index overflow for static as expected int[size-1] b; // stack overflow int[250_001] c; // stack overflow int[250_000] d; // ok

Re: Static array size limit

2011-04-02 Thread bearophile
simendsjo: The main problem is that it gives a Stack Overflow already at 250_001 I meant with the array as a global variable. The stack on Windows can be set very large too, with -L/STACK:1000 Bye, bearophile