Where does "U" in Rebindable.Rebindable come from?

2012-03-29 Thread simendsjo
If you look at the struct, it uses the type U in, among others, the union. The only place I could see U referenced is in the first static if, but I cannot recreate this behavior: void main() { static if(is(int X == const(U), U)) { } else { static assert(is(typeof(U)

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-29 Thread Tove
On Thursday, 29 March 2012 at 20:15:43 UTC, simendsjo wrote: If you look at the struct, it uses the type U in, among others, the union. The only place I could see U referenced is in the first static if, but I cannot recreate this behavior: void main() { static if(is(int X == const(U), U))

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-29 Thread Ali Çehreli
On 03/29/2012 01:51 PM, Tove wrote: On Thursday, 29 March 2012 at 20:15:43 UTC, simendsjo wrote: If you look at the struct, it uses the type U in, among others, the union. The only place I could see U referenced is in the first static if, but I cannot recreate this behavior: void main() { stati

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-29 Thread Simen Kjærås
On Thu, 29 Mar 2012 22:15:41 +0200, simendsjo wrote: If you look at the struct, it uses the type U in, among others, the union. The only place I could see U referenced is in the first static if, but I cannot recreate this behavior: void main() { static if(is(int X == const(U), U))

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-30 Thread simendsjo
On Fri, 30 Mar 2012 01:09:06 +0200, Simen Kjærås wrote: On Thu, 29 Mar 2012 22:15:41 +0200, simendsjo wrote: If you look at the struct, it uses the type U in, among others, the union. The only place I could see U referenced is in the first static if, but I cannot recreate this behav

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-30 Thread Simen Kjærås
On Fri, 30 Mar 2012 15:03:49 +0200, simendsjo wrote: On Fri, 30 Mar 2012 01:09:06 +0200, Simen Kjærås wrote: On Thu, 29 Mar 2012 22:15:41 +0200, simendsjo wrote: If you look at the struct, it uses the type U in, among others, the union. The only place I could see U referenced is in

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-30 Thread simendsjo
On Fri, 30 Mar 2012 17:13:25 +0200, Simen Kjærås wrote: Indeed. The thing is - U is basically *set* by the isExpression. It says 'yes, there is such a U, so I'll add it to the local scope.'. This means that U will be set for the entire scope within which the static if exists. Due to the way t

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-30 Thread Philippe Sigaud
On Fri, Mar 30, 2012 at 01:09, Simen Kjærås wrote: > The same pattern is used in std.typecons.isTuple: > > template isTuple(T) > { >    static if (is(Unqual!T Unused : Tuple!Specs, Specs...)) >    { Wait, does that work now? They added 'is(XXX, YYY...)'?

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-30 Thread Timon Gehr
On 03/30/2012 09:20 PM, Philippe Sigaud wrote: On Fri, Mar 30, 2012 at 01:09, Simen Kjærås wrote: The same pattern is used in std.typecons.isTuple: template isTuple(T) { static if (is(Unqual!T Unused : Tuple!Specs, Specs...)) { Wait, does that work now? Yes. They added 'is(XXX, Y

Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-31 Thread Philippe Sigaud
On Fri, Mar 30, 2012 at 23:00, Timon Gehr wrote: >> Wait, does that work now? > > > Yes. > > >> They added 'is(XXX, YYY...)'? > > > The syntax is static if(is(XXX Unused, YYY...)). (Where Unused is something > you never have any use for.) OK, time to update my template tutorial, then.

Re: Where does "U" in Rebindable.Rebindable come from?

2012-04-01 Thread Simen Kjærås
On Fri, 30 Mar 2012 19:52:50 +0200, simendsjo wrote: On Fri, 30 Mar 2012 17:13:25 +0200, Simen Kjærås wrote: Indeed. The thing is - U is basically *set* by the isExpression. It says 'yes, there is such a U, so I'll add it to the local scope.'. This means that U will be set for the entire sc