On 4/5/11 12:21 PM, enuhtac wrote:
[…]
static if (is(int[10] W : W[V], int V))
what is the essential difference to:
static if( is( A!(int, "xxx") T == A!(T, s), string s ) )
This is probably merely a bug, I just stumbled across something similar:
http://d.puremagic.com/issues/show_bu
compiler knows about arrays and associated
arrays, whereas it isn't smart enough to extract the correct
information from a templated type? The is() expression was not
developed from first principles: it grew 'organically' as a
hodge-podge of tricks and needs.
Am 03.04.2011 16:11, schrieb Philippe Sigaud:
> On Sat, Apr 2, 2011 at 13:05, enuhtac wrote:
>> This is the type I would like to check for:
>>
>> struct A( T, string s )
>> { ... };
> Hi,
>
> the trick is to use a function do the work for you. Let's define isAnA:
>
> void isAnA(T, string s)( A!(T,
On Sat, Apr 2, 2011 at 13:05, enuhtac wrote:
> This is the type I would like to check for:
>
> struct A( T, string s )
> { ... };
Hi,
the trick is to use a function do the work for you. Let's define isAnA:
void isAnA(T, string s)( A!(T,s) a) { }
isAnA can only be called (compiled) with your A.
Am 02.04.2011 04:00, schrieb Caligo:
> On Fri, Apr 1, 2011 at 5:14 PM, enuhtac 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 figure
;
> What does ", string s" do here inside the is expression?
>
> Denis
A takes two template parameters: a type "T" and a value "string s". So I
need to specify both parameters in the is expression. In the D manual
you find something similar:
static if (is(int[10] W : W[V], int V))
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
On Fri, Apr 1, 2011 at 5:14 PM, enuhtac 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 given type.
&
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 given type.
This is the type I would like to check for:
struct A( T, string s )
{ ... };
One