BackMath: a compile time symbolic math lib.

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Dec 4 21:40:02 PST 2007


"BCS" <ao at pathlink.com> wrote in message 
news:ce0a33432689c8ca049e1da7fc2e at news.digitalmars.com...
>
> what I need is something that would work like this:
>
> struct S(alias r)
> {
>   real Get(){return r;}
> }
>
> void Do()
> {
>   real a;
>   S!(a) s;
>   real b = s.Get();
> }
>
> the issue is that the struct doesn't have access to the function. There is 
> no reason this should be impossible, but the semantics of how to make it 
> work would be a major project in and of it's self.
>
> If anyone can find a workaround I'm open to suggestions.

Ooh, I see.  Actually I think templated _functions_ with alias parameters 
can be called with aliases to local variables -- in which case, IIRC, the 
templated function will actually be instantiated as a nested function within 
that function, giving it access to the calling function's stack frame.  But 
you're right, this is incredibly difficult to do in the general case. 





More information about the Digitalmars-d-announce mailing list