Getting around the non-virtuality of templates

2012-03-25 Thread Stewart Gordon
I'm coming up against some interesting challenges while porting stuff in my utility library to D2. Firstly, D2 uses opBinary and opOpAssign, rather than the operator-specific op* and op*Assign. While the latter still work, they aren't mentioned in the current D2 docs. Which would imply that t

Re: Getting around the non-virtuality of templates

2012-03-25 Thread James Miller
On 26 March 2012 11:36, Stewart Gordon wrote: > I'm coming up against some interesting challenges while porting stuff in my > utility library to D2. > > Firstly, D2 uses opBinary and opOpAssign, rather than the operator-specific > op* and op*Assign.  While the latter still work, they aren't mentio

Re: Getting around the non-virtuality of templates

2012-03-25 Thread Simen Kjærås
On Mon, 26 Mar 2012 00:36:08 +0200, Stewart Gordon wrote: I'm coming up against some interesting challenges while porting stuff in my utility library to D2. Firstly, D2 uses opBinary and opOpAssign, rather than the operator-specific op* and op*Assign. While the latter still work, they

Re: Getting around the non-virtuality of templates

2012-03-26 Thread Steven Schveighoffer
On Sun, 25 Mar 2012 18:36:08 -0400, Stewart Gordon wrote: I'm coming up against some interesting challenges while porting stuff in my utility library to D2. Firstly, D2 uses opBinary and opOpAssign, rather than the operator-specific op* and op*Assign. While the latter still work, they

Re: Getting around the non-virtuality of templates

2012-03-27 Thread Stewart Gordon
On 26/03/2012 14:37, Steven Schveighoffer wrote: So for now, I use the undocumented old-style functions. One other thing that this "wrapper" method loses is covariance, which I use a lot in dcollections. I haven't filed a bug on it, but there is at least a workaround on this one -- the templat

Re: Getting around the non-virtuality of templates

2012-03-27 Thread Artur Skawina
On 03/27/12 17:12, Stewart Gordon wrote: > On 26/03/2012 14:37, Steven Schveighoffer wrote: > >> So for now, I use the undocumented old-style functions. One other thing that >> this >> "wrapper" method loses is covariance, which I use a lot in dcollections. I >> haven't filed a >> bug on it, but

Re: Getting around the non-virtuality of templates

2012-03-27 Thread Stewart Gordon
On 27/03/2012 16:12, Stewart Gordon wrote: On 26/03/2012 14:37, Steven Schveighoffer wrote: So for now, I use the undocumented old-style functions. One other thing that this "wrapper" method loses is covariance, which I use a lot in dcollections. I haven't filed a bug on it, but there is at l

Re: Getting around the non-virtuality of templates

2012-03-27 Thread Steven Schveighoffer
On Tue, 27 Mar 2012 11:26:08 -0400, Stewart Gordon wrote: On 27/03/2012 16:12, Stewart Gordon wrote: On 26/03/2012 14:37, Steven Schveighoffer wrote: So for now, I use the undocumented old-style functions. One other thing that this "wrapper" method loses is covariance, which I use a lot i

Re: Getting around the non-virtuality of templates

2012-03-27 Thread Stewart Gordon
On 27/03/2012 16:46, Steven Schveighoffer wrote: One tip -- if you are doing method as above inside a class and not an interface, you can use: cast(T)cast(void*)this; which should avoid the unnecessary dynamic cast. Which would work if the function always returns this. But in the general c