static if for array type templates
Oskar Linde
oskar.lindeREM at OVEgmail.com
Sun Apr 16 13:32:09 PDT 2006
In article <e1qo6h$2012$1 at digitaldaemon.com>, Frank Benoit says...
>
>if compiled with -version=witharray it gives an error about:
>arithmetic/string type expected for value-parameter, not int[]
>
>But I have this static if... ?
>
>/**/ class C( T ){
>/**/
>/**/ T mValue;
>/**/
>/**/ // not for array types
>/**/ static if( !is( T : T[] )){
[snip]
is-expressions does not behave in the same way as template argument
specialization. The above code reads: true when T is implicitly convertible to
T[] (never). Try something like this instead (untested):
template ArrayType(T:T[]) {
alias T ArrayType;
}
..
static if ( !is( ArrayType!(T) )) {
/Oskar
More information about the Digitalmars-d
mailing list